Skip to content

Commit 5684270

Browse files
committed
v0.6.2, toggle auto bullet points
1 parent c4d927d commit 5684270

7 files changed

Lines changed: 89 additions & 34 deletions

File tree

.vscodeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ vsc-extension-quickstart.md
1414
**/.vscode-test.*
1515
docs/**
1616
notes/**
17-
PRD.md
17+
PRD.md
18+
pnpm-lock.yaml

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to the "pointblank" extension will be documented in this file.
44

5+
## [0.6.2] - 2025-06-27
6+
### Added
7+
- New setting and command: **Toggle Auto Bullets** (`pointblank.toggleAutoBullets`). You can now enable or disable automatic bullet point insertion for new lines and pastes, with a default keybinding (`Alt+B`).
8+
### Fixed
9+
- Multi-line paste: If the first line of the pasted content is empty, default bullet points are now correctly added to all following non-empty lines (when auto bullets are enabled).
10+
511
## [6.1.0] - 2025-06-15
612

713
### Added

docs/index.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ <h2>Welcome to Point Blank Documentation</h2>
99
<p>Get the extension on the <a href="https://marketplace.visualstudio.com/items?itemName=fastblit.pointblank">VS Code Marketplace</a>!</p>
1010
</section>
1111

12-
<section id="whats-new">
13-
<h2>What's New in 6.1.0</h2>
14-
<p>
15-
Point Blank now includes a powerful new inline query language! You can now
16-
dynamically pull information from across your workspace directly into your notes.
17-
Use `LIST` to create lists of links to files or content blocks, or use the new
18-
`TRANSCLUDE` keyword to embed content directly.
19-
Learn more about this powerful new feature on the
20-
<a href="queries.html">Queries page</a>.
21-
</p>
22-
</section>
23-
2412
<section id="features">
2513
<h2><a href="features.html">Features</a></h2>
2614
<p>Detailed explanations of Point Blank's intelligent bullet point styling, hierarchical outlining, typed nodes, template expansion, and focus mode.</p>

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "git",
88
"url": "https://github.com/ryanncode/point-blank"
99
},
10-
"version": "0.6.1",
10+
"version": "0.6.2",
1111
"engines": {
1212
"vscode": "^1.100.0"
1313
},
@@ -52,6 +52,10 @@
5252
{
5353
"command": "pointblank.updateTypeQuery",
5454
"title": "Point Blank: Update Type Query"
55+
},
56+
{
57+
"command": "pointblank.toggleAutoBullets",
58+
"title": "Point Blank: Toggle Auto Bullets"
5559
}
5660
],
5761
"keybindings": [
@@ -88,6 +92,12 @@
8892
"key": "enter",
8993
"command": "pointblank.enterKey",
9094
"when": "editorTextFocus && editorLangId == 'markdown'"
95+
},
96+
{
97+
"command": "pointblank.toggleAutoBullets",
98+
"key": "alt+b",
99+
"mac": "alt+b",
100+
"when": "editorTextFocus"
91101
}
92102
],
93103
"configuration": {
@@ -145,6 +155,11 @@
145155
"type": "number",
146156
"default": 20,
147157
"description": "The number of extra lines to render above and below the visible viewport for decorations. Increase for smoother scrolling effects."
158+
},
159+
"pointblank.autoBullets": {
160+
"type": "boolean",
161+
"default": true,
162+
"description": "Automatically insert bullet points on new lines. Toggle with the Point Blank: Toggle Auto Bullets command."
148163
}
149164
}
150165
}

src/commands/commandManager.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BlockNode } from '../document/blockNode';
55
import { PasteWithBullets } from './pasteWithBullets';
66
import { EnterKeyHandler } from './enterKey';
77
import { getBulletFromLine } from '../utils/bulletPointUtils';
8+
import { Configuration } from '../config/configuration';
89
import { QueryService } from '../queries/queryService';
910
import * as path from 'path';
1011

@@ -87,17 +88,19 @@ export class CommandManager {
8788
* @param context The extension context.
8889
*/
8990
private registerCommandOverrides(context: vscode.ExtensionContext): void {
91+
const config = Configuration.getInstance();
9092
// --- `type` Command Override ---
9193
// Automatically inserts a bullet point when typing on an empty line.
9294
const typeCommand = vscode.commands.registerTextEditorCommand('type', async (editor, _edit, args) => {
9395
const position = editor.selection.active;
9496
const line = editor.document.lineAt(position.line);
9597
const typedChar = args.text;
9698

97-
// If the typed character is a newline, delegate to our custom Enter key handler.
98-
99-
// Check if the user is typing '[[', especially at the beginning of a line after a bullet.
100-
// This is a specific trigger for Foam's backlink completion.
99+
// If autoBullets is disabled, fall back to default behavior for bullet logic.
100+
if (!config.getAutoBullets()) {
101+
await vscode.commands.executeCommand('default:type', args);
102+
return;
103+
}
101104
if (typedChar === '[' && position.character > 0 && line.text.charAt(position.character - 1) === '[') {
102105
await vscode.commands.executeCommand('default:type', args);
103106
return;
@@ -202,7 +205,20 @@ export class CommandManager {
202205
});
203206

204207
const pasteWithBulletsInstance = new PasteWithBullets(this.extensionState);
205-
const pasteWithBulletsCommand = vscode.commands.registerTextEditorCommand('pointblank.pasteWithBullets', () => pasteWithBulletsInstance.pasteWithBulletsCommand());
208+
const pasteWithBulletsCommand = vscode.commands.registerTextEditorCommand('pointblank.pasteWithBullets', async () => {
209+
if (!config.getAutoBullets()) {
210+
await vscode.commands.executeCommand('editor.action.clipboardPasteAction');
211+
return;
212+
}
213+
await pasteWithBulletsInstance.pasteWithBulletsCommand();
214+
});
215+
const toggleAutoBulletsCommand = vscode.commands.registerCommand('pointblank.toggleAutoBullets', async () => {
216+
const current = config.getAutoBullets();
217+
await config.setAutoBullets(!current);
218+
// Show a notification that disappears quickly (1s)
219+
const message = `Point Blank: Auto Bullets ${!current ? 'Enabled' : 'Disabled'}`;
220+
const disposable = vscode.window.setStatusBarMessage(message, 5000);
221+
});
206222

207223
// --- Default Behavior Fallbacks ---
208224
// These commands currently fall back to default behavior but are registered for future extension.
@@ -219,6 +235,7 @@ export class CommandManager {
219235
tabCommand,
220236
outdentCommand,
221237
pasteWithBulletsCommand,
238+
toggleAutoBulletsCommand,
222239
// --- New Commands ---
223240
vscode.commands.registerTextEditorCommand('pointblank.insertTypeQuery', async (editor) => {
224241
const typeName = await vscode.window.showInputBox({

src/commands/pasteWithBullets.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class PasteWithBullets {
1919
*/
2020
public async pasteWithBulletsCommand(): Promise<void> {
2121
const editor = vscode.window.activeTextEditor;
22-
if (!editor) return;
22+
if (!editor) { return; }
2323

2424
const clipboardText = await vscode.env.clipboard.readText();
2525
const clipboardLines = clipboardText.split(/\r?\n/);
@@ -40,27 +40,42 @@ export class PasteWithBullets {
4040
// Remove the first empty line from clipboard content
4141
const contentToPaste = clipboardLines.slice(1);
4242

43-
// Append the partAfterCursor to the last line of the pasted content
44-
if (contentToPaste.length > 0) {
45-
contentToPaste[contentToPaste.length - 1] += partAfterCursor;
46-
} else {
47-
// If only an empty line was copied, and nothing else, then just paste nothing.
48-
// This case should ideally be handled by the clipboardLines.length === 0 check above,
49-
// but as a safeguard.
50-
await vscode.commands.executeCommand('default:paste');
43+
// If all lines after the first are empty, just insert a blank line
44+
if (contentToPaste.every(line => line.trim() === '')) {
45+
await editor.edit(editBuilder => {
46+
editBuilder.replace(currentLine.range, partBeforeCursor + '\n' + partAfterCursor);
47+
});
48+
const newPosition = new vscode.Position(selection.start.line + 1, 0);
49+
editor.selection = new vscode.Selection(newPosition, newPosition);
5150
return;
5251
}
5352

54-
const textToInsert = partBeforeCursor + '\n' + contentToPaste.join('\n');
55-
53+
// Otherwise, process the lines for bullet logic
54+
// Use the same logic as processClipboardLines, but skip the first line
55+
const documentModel = this._extensionState.getDocumentModel(document.uri.toString());
56+
if (!documentModel) {
57+
await vscode.commands.executeCommand('default:paste');
58+
return;
59+
}
60+
const currentBlockNode = documentModel.documentTree.getNodeAtLine(currentLine.lineNumber);
61+
if (!currentBlockNode) {
62+
await vscode.commands.executeCommand('default:paste');
63+
return;
64+
}
65+
// Fake a selection at the start of the line for bullet logic
66+
const fakeSelection = new vscode.Selection(selection.start.line, 0, selection.start.line, 0);
67+
const processedLines = this.processClipboardLines(contentToPaste, currentLine, currentBlockNode, fakeSelection);
68+
// Append the partAfterCursor to the last line
69+
if (processedLines.length > 0) {
70+
processedLines[processedLines.length - 1] += partAfterCursor;
71+
}
72+
const textToInsert = partBeforeCursor + '\n' + processedLines.join('\n');
5673
await editor.edit(editBuilder => {
57-
// Replace the current line with the modified content
5874
editBuilder.replace(currentLine.range, textToInsert);
5975
});
60-
6176
// Set the new cursor position at the end of the pasted content
62-
const newPositionLine = selection.start.line + contentToPaste.length;
63-
const newPositionChar = contentToPaste[contentToPaste.length - 1].length - partAfterCursor.length;
77+
const newPositionLine = selection.start.line + processedLines.length;
78+
const newPositionChar = processedLines.length > 0 ? processedLines[processedLines.length - 1].length - partAfterCursor.length : 0;
6479
const newPosition = new vscode.Position(newPositionLine, newPositionChar);
6580
editor.selection = new vscode.Selection(newPosition, newPosition);
6681
return;

src/config/configuration.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ import * as vscode from 'vscode';
66
* and to initialize VS Code decoration types based on those settings.
77
*/
88
export class Configuration {
9+
/**
10+
* Gets whether automatic bullet insertion is enabled.
11+
*/
12+
public getAutoBullets(): boolean {
13+
return this.getConfiguration().get<boolean>('autoBullets', true);
14+
}
15+
16+
/**
17+
* Sets whether automatic bullet insertion is enabled.
18+
*/
19+
public async setAutoBullets(value: boolean): Promise<void> {
20+
await this.getConfiguration().update('autoBullets', value, vscode.ConfigurationTarget.Global);
21+
}
922
private static _instance: Configuration;
1023

1124
private constructor() { }

0 commit comments

Comments
 (0)