clarkio / vscode-twitch-highlighter

This is a VS Code extension that will allow your Twitch chat to highlight a line of code via a command message. Example: `!line 8 server.js`. See master branch README.md for more details
https://clarkio.com
203 stars 14 forks source link

Bug Fixes for #42 and #44 #46

Closed parithon closed 5 years ago

parithon commented 5 years ago

TLDR;

The issues occured when the user opens an individual file and not a folder (workspace). This was because we used relative paths when working with the documents instead of full paths.

Issue #44

We designed the extension to assume a workspace is always defined. This is not the case when an individual file is opened. When an individual file is opened, the vscode.workspace.rootPath would be undefined which wouldn't provide the correct fileName used by the removeHighlighter to identify which highlight to remove.

Issue #42

Additionally, because the fileName was inaccurate, the gotoHighlightCommand did not have a good reference to open the document. VSCode assumes the incorrect fileName should result in a request for a new document. This is why when you clicked on the highlight tree-item it would open a new document instead of switching to the existing document.


Identified issue

Resolution

Changed Files

twitchHighlighterTreeview.ts

extension.ts

Addresses

42

44

clarkio commented 5 years ago

@parithon thanks for working on this! Would it be possible to also include steps to test? Is it just that we need to open a file without a folder open?

parithon commented 5 years ago

@clarkio Correct. If you only had a file open and not a folder the vscode.workspace.rootPath would be undefined and our relative paths would be inaccurate.