Skip to content

Commit

Permalink
Allows to restart nimsuggest per file basis
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez committed Sep 15, 2024
1 parent 737eea0 commit 906fac1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions routes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,17 @@ proc extensionCapabilities*(ls: LanguageServer, _: JsonNode): Future[seq[string]

proc extensionSuggest*(ls: LanguageServer, params: SuggestParams): Future[SuggestResult] {.async.} =
debug "Extension Suggest ", params = params
let projectFile = params.projectFile
if projectFile != "*" and projectFile notin ls.projectFiles:
error "Project file must exists ", params = params
return SuggestResult()
var projectFile = params.projectFile
if projectFile != "*" and projectFile notin ls.projectFiles:
#test if just a regular file
let uri = projectFile.pathToUri
if uri in ls.openFiles:
let openFile = ls.openFiles[uri]
projectFile = await openFile.projectFile
debug "[ExtensionSuggest] Found project file for ", file = params.projectFile, project = projectFile
else:
error "Project file must exists ", params = params
return SuggestResult()
template restart() =
ls.showMessage(fmt "Restarting nimsuggest {projectFile}", MessageType.Info)
ns.stop()
Expand Down

0 comments on commit 906fac1

Please sign in to comment.