Skip to content

Commit b8904f2

Browse files
committed
fix: Improve hack
1 parent 249b2a1 commit b8904f2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/createLanguageClient.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { MessageReader, MessageWriter, Message, Event, DataCallback, Disposable, PartialMessageInfo } from 'vscode-jsonrpc'
2-
import { Uri } from 'monaco-editor'
32
import {
43
MonacoLanguageClient, Middleware, ErrorHandler, IConnectionProvider, MessageTransports
54
} from 'monaco-languageclient'
@@ -106,11 +105,10 @@ function hackTransports (transports: MessageTransports): MessageTransports {
106105
if (Message.isRequest(message) && message.method === InitializeRequest.type.method) {
107106
const params = message.params as InitializeParams
108107
// Hack to fix url converted from /toto/tata to \\toto\tata in windows
109-
const rootPath = params.rootPath?.replace(/\\/g, '/')
110108
const fixedParams: InitializeParams = {
111109
...params,
112-
rootPath,
113-
rootUri: rootPath != null ? Uri.from({ scheme: 'file', path: rootPath }).toString() : null
110+
rootPath: params.rootPath?.replace(/\\/g, '/'),
111+
rootUri: params.rootUri?.replace(/\\/g, '/') ?? null
114112
}
115113
return {
116114
...message,

0 commit comments

Comments
 (0)