Skip to content

Commit 4a13c19

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents eed0d7a + 7caaad1 commit 4a13c19

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

server/package-lock.json

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
},
1515
"dependencies": {
1616
"@types/vscode": "^1.67.0",
17+
"tmp": "^0.2.1",
1718
"vscode-languageserver": "^8.1.0",
1819
"vscode-languageserver-textdocument": "^1.0.8",
19-
"tmp": "^0.2.1"
20+
"vscode-uri": "^3.0.7"
2021
},
2122
"devDependencies": {
2223
"@types/tmp": "^0.2.3"

server/src/server.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ import {
2828
Position,
2929
} from "vscode-languageserver-protocol";
3030

31-
import { fileURLToPath } from "node:url";
3231
import { TextEncoder } from "node:util";
3332
import { TextDocument } from "vscode-languageserver-textdocument";
33+
import { URI } from 'vscode-uri';
34+
3435

3536
interface NuTextDocument extends TextDocument {
3637
nuInlayHints?: InlayHint[];
@@ -58,9 +59,9 @@ let hasWorkspaceFolderCapability = false;
5859
let hasDiagnosticRelatedInformationCapability = false;
5960

6061
function includeFlagForPath(file_path: string): string {
61-
if (file_path.startsWith("file://")) {
62-
file_path = decodeURI(file_path);
63-
return "-I " + '"' + path.dirname(fileURLToPath(file_path));
62+
const parsed = URI.parse(file_path);
63+
if (parsed.scheme === "file") {
64+
return "-I " + '"' + path.dirname(parsed.fsPath);
6465
}
6566
return "-I " + '"' + file_path;
6667
}
@@ -614,7 +615,7 @@ async function goToDefinition(
614615
if (obj.file == tmpFile.name) {
615616
uri = document.uri;
616617
} else {
617-
uri = obj.file ? "file://" + obj.file : document.uri;
618+
uri = obj.file ? URI.file(obj.file).toString() : document.uri;
618619
}
619620

620621
// connection.console.log(uri);

0 commit comments

Comments
 (0)