Skip to content

Commit

Permalink
should not crash when the projectMapping fileRegex is set to a non ex…
Browse files Browse the repository at this point in the history
…isting file fixes #221 (#223)
  • Loading branch information
jmgomez authored Jul 29, 2024
1 parent 69e94dd commit 7c6df11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nimlangserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ proc getProjectFile(fileUri: string, ls: LanguageServer): Future[string] {.async
for mapping in mappings:
if find(cstring(pathRelativeToRoot), re(mapping.fileRegex), 0, pathRelativeToRoot.len) != -1:
result = string(rootPath) / mapping.projectFile
trace "getProjectFile", project = result, uri = fileUri, matchedRegex = mapping.fileRegex
return result
if fileExists(result):
trace "getProjectFile", project = result, uri = fileUri, matchedRegex = mapping.fileRegex
return result
else:
trace "getProjectFile does not match", uri = fileUri, matchedRegex = mapping.fileRegex

Expand Down

0 comments on commit 7c6df11

Please sign in to comment.