For some reason this command isn't working for me
Paste html as markdown
And I went to read the source code and debug it
However, it's really hard to pin point where the issue is happening
|
const pasteHtmlAsMarkdown = async () => { |
|
try { |
|
const tdService = new TurndownService(tdSettings); |
|
|
|
const clipboard = await readClipboard(); |
|
|
|
const markdown = tdService.turndown(clipboard); |
|
|
|
const editor = vscode.window.activeTextEditor; |
|
|
|
if (!editor) { |
|
return; |
|
} |
|
|
|
editor.edit((edit) => { |
|
const current = editor.selection; |
|
|
|
editor.selections.forEach((selection) => { |
|
if (selection.isEmpty) { |
|
edit.insert(selection.start, markdown); |
|
} else { |
|
edit.replace(current, markdown); |
|
} |
|
}); |
|
}); |
When I issue the command nothing happens. There could be multiple reasons why thats not happening
- Is vscode bugged and not issuing the comamnd?
- Is editor a falsy value?
- Are selections empty?
I'm just going to manually use turndown for now but I hope you add more logging so its easier to troubleshoot
For some reason this command isn't working for me
Paste html as markdownAnd I went to read the source code and debug it
However, it's really hard to pin point where the issue is happening
memo/src/commands/pasteHtmlAsMarkdown.ts
Lines 11 to 35 in 525e777
When I issue the command nothing happens. There could be multiple reasons why thats not happening
I'm just going to manually use turndown for now but I hope you add more logging so its easier to troubleshoot