Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging for commands in general #607

Open
nopeless opened this issue Oct 25, 2022 · 4 comments
Open

Better logging for commands in general #607

nopeless opened this issue Oct 25, 2022 · 4 comments

Comments

@nopeless
Copy link

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

@nopeless
Copy link
Author

I mean I could clone it and go through the whole debugging myself but at the moment its just not worth the time

@svsool
Copy link
Owner

svsool commented Oct 25, 2022

Maybe you could paste what you are trying to copy to reproduce the problem.

Also what version you are using and in which env.

Thanks

@nopeless
Copy link
Author

@svsool I followed the gif you shown

Using windows

lastest version of the extension in vscode

vs code is latest I believe

Btw, if you are trying to fix the problem I am encountering, you are missingn the point of the issue

@nopeless
Copy link
Author

Will you add logging options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants