-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from pro-vision/feature/vscode-hbs-errors
vscode hbs plugin, additional features
- Loading branch information
Showing
20 changed files
with
3,363 additions
and
1,384 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
packages/vscode-pv-handlebars-language-server/client/src/commands.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { commands, window, Location, Uri, Range, Position } from "vscode"; | ||
import { type Location as LSLocation } from "vscode-languageclient/node"; | ||
|
||
/** | ||
* converts locations of type vscode-languageclient/node to `Location` from `vscode` (client) extension | ||
* | ||
* @param {LSLocation} locations - code locations | ||
* @returns {Location} | ||
*/ | ||
function castLocationsType({ uri, range }: LSLocation) { | ||
return new Location( | ||
Uri.file(uri), | ||
new Range(new Position(range.start.line, range.start.character), new Position(range.end.line, range.end.character)), | ||
); | ||
} | ||
|
||
// trigger vscode build-in command to navigate to the given code location(s) | ||
export function goToLocation(location: LSLocation) { | ||
commands.executeCommand( | ||
"editor.action.goToLocations", | ||
window.activeTextEditor.document.uri, // from | ||
window.activeTextEditor.selection.active, | ||
[castLocationsType(location)], // to | ||
"peek", // for multiple options (if we use LSLocation[]), show the list and allow the user to choose | ||
"", | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/vscode-pv-handlebars-language-server/client/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.