@@ -28,9 +28,10 @@ import {
2828 Position ,
2929} from "vscode-languageserver-protocol" ;
3030
31- import { fileURLToPath } from "node:url" ;
3231import { TextEncoder } from "node:util" ;
3332import { TextDocument } from "vscode-languageserver-textdocument" ;
33+ import { URI } from 'vscode-uri' ;
34+
3435
3536interface NuTextDocument extends TextDocument {
3637 nuInlayHints ?: InlayHint [ ] ;
@@ -58,9 +59,9 @@ let hasWorkspaceFolderCapability = false;
5859let hasDiagnosticRelatedInformationCapability = false ;
5960
6061function 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