File tree 1 file changed +28
-0
lines changed 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,34 @@ export class ClangdContext implements vscode.Disposable {
100
100
// Do not switch to output window when clangd returns output.
101
101
revealOutputChannelOn : vscodelc . RevealOutputChannelOn . Never ,
102
102
103
+ uriConverters : {
104
+ code2Protocol : ( uri : vscode . Uri ) : string => {
105
+ if ( process . platform === 'win32' ) {
106
+
107
+ if ( uri . scheme === 'file' ) {
108
+ // https://github.com/clangd/vscode-clangd/issues/726
109
+ // Remove this workaround once clangd fixes the issue on their side: https://github.com/clangd/clangd/issues/108
110
+
111
+ // Fix lower case drive letters on Windows
112
+ let fsPath = uri . fsPath
113
+
114
+ // Extract the drive letter (first two characters, e.g., "c:")
115
+ const driveLetterMatch = fsPath . match ( / ^ ( [ a - z ] ) : / i) ;
116
+
117
+ if ( driveLetterMatch ) {
118
+ // Convert the drive letter to uppercase
119
+ const driveLetter = driveLetterMatch [ 1 ] . toUpperCase ( ) ;
120
+ // Replace the old drive letter with the new one
121
+ return "file:///" + fsPath . replace ( / ^ ( [ a - z ] ) : / i, `${ driveLetter } :` ) ;
122
+ }
123
+
124
+ }
125
+ }
126
+ return uri . toString ( ) ;
127
+ } ,
128
+ protocol2Code : ( uri : string ) => vscode . Uri . parse ( uri ) ,
129
+ } ,
130
+
103
131
// We hack up the completion items a bit to prevent VSCode from re-ranking
104
132
// and throwing away all our delicious signals like type information.
105
133
//
You can’t perform that action at this time.
0 commit comments