Skip to content

Commit 4b18ef0

Browse files
committed
Set snippet title
1 parent 9ed5b21 commit 4b18ef0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/commands/snippet.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export function registerSnippetCommands(context: vscode.ExtensionContext) {
1212

1313
const textRange = new vscode.Range(editor.selection.start.line, editor.selection.start.character, editor.selection.end.line, editor.selection.end.character);
1414
const text = vscode.window.activeTextEditor.document.getText(textRange);
15-
const snippet = `> \`${vscode.workspace.asRelativePath(editor.document.uri.fsPath)}\`\n\n\`\`\`${editor.document.languageId}=${editor.selection.start.line + 1}\n${text}\n\`\`\``;
15+
const filePath = vscode.workspace.asRelativePath(editor.document.uri.fsPath)
16+
const snippet = `---\ntitle: public/${filePath}\n---\n> \`${filePath}\`\n\n\`\`\`${editor.document.languageId}=${editor.selection.start.line + 1}\n${text}\n\`\`\``;
1617

1718
const noteUrl = await API.newNote(snippet);
1819
const clicked = await vscode.window.showInformationMessage('New Snippet Established!', ...['Copy URL to clip board', 'Open in browser']);

0 commit comments

Comments
 (0)