From 69b8e222f84b75ccc0fb4ef53e9a4d222707b630 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Tue, 6 Feb 2024 22:59:17 +0200 Subject: [PATCH] * in case rootUri is null, but rootPath is set, take rootPath instead of using the current directory. This should improve performance with editors that only send rootPath, but no rootUri, such as Helix. Fixes #59. --- nimlangserver.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nimlangserver.nim b/nimlangserver.nim index 7b46be3..b62ea92 100644 --- a/nimlangserver.nim +++ b/nimlangserver.nim @@ -177,7 +177,10 @@ proc getWorkspaceConfiguration(ls: LanguageServer): Future[NlsConfig] {.async.} proc getRootPath(ip: InitializeParams): string = if ip.rootUri.isNone or ip.rootUri.get == "": - return getCurrentDir().pathToUri.uriToPath + if ip.rootPath.isSome and ip.rootPath.get != "": + return ip.rootPath.get + else: + return getCurrentDir().pathToUri.uriToPath return ip.rootUri.get.uriToPath proc getProjectFile(fileUri: string, ls: LanguageServer): Future[string] {.async.} =