Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Sep 17, 2023
1 parent ab3c0d6 commit c08ee60
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions nimlsp/nimlsp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/completion":
textDocumentRequest(message, CompletionParams, req):
debugLog location(req)
let suggestions = getNimsuggest(req.fileuri).sug(req.filePath, dirtyfile = req.filestash,
let suggestions = getNimsuggest(req.fileuri).sug(req.filePath, req.filestash,
req.rawLine + 1,
openFiles.col(req)
)
Expand Down Expand Up @@ -206,7 +206,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/hover":
textDocumentRequest(message, TextDocumentPositionParams, req):
debugLog location(req)
let suggestions = getNimsuggest(req.fileuri).def(req.filePath, dirtyfile = req.filestash,
let suggestions = getNimsuggest(req.fileuri).def(req.filePath, req.filestash,
req.rawLine + 1,
openFiles.col(req)
)
Expand All @@ -232,7 +232,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/references":
textDocumentRequest(message, ReferenceParams, req):
debugLog location(req)
let suggestions = getNimsuggest(req.fileuri).use(req.filePath, dirtyfile = req.filestash,
let suggestions = getNimsuggest(req.fileuri).use(req.filePath, req.filestash,
req.rawLine + 1,
openFiles.col(req)
)
Expand All @@ -255,7 +255,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/rename":
textDocumentRequest(message, RenameParams, req):
debugLog location(req)
let suggestions = getNimsuggest(req.fileuri).use(req.filePath, dirtyfile = req.filestash,
let suggestions = getNimsuggest(req.fileuri).use(req.filePath, req.filestash,
req.rawLine + 1,
openFiles.col(req)
)
Expand Down Expand Up @@ -284,7 +284,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/definition":
textDocumentRequest(message, TextDocumentPositionParams, req):
debugLog location(req)
let declarations = getNimsuggest(req.fileuri).def(req.filePath, dirtyfile = req.filestash,
let declarations = getNimsuggest(req.fileuri).def(req.filePath, req.filestash,
req.rawLine + 1,
openFiles.col(req)
)
Expand All @@ -310,7 +310,7 @@ proc main(ins: Stream, outs: Stream) =
let projectFile = openFiles[req.fileuri].projectFile
let syms = getNimsuggest(req.fileuri).outline(
req.filePath,
dirtyfile = req.filestash
req.filestash
)
debugLog "Found outlines: " & $syms.len
debugSuggests(syms[0..<min(syms.len, 10)])
Expand Down Expand Up @@ -344,7 +344,7 @@ proc main(ins: Stream, outs: Stream) =
of "textDocument/signatureHelp":
textDocumentRequest(message, TextDocumentPositionParams, req):
debugLog location(req)
let suggestions = getNimsuggest(req.fileuri).con(req.filePath, dirtyfile = req.filestash, req.rawLine + 1, req.rawChar)
let suggestions = getNimsuggest(req.fileuri).con(req.filePath, req.filestash, req.rawLine + 1, req.rawChar)
var signatures = newSeq[SignatureInformation]()
for suggestion in suggestions:
var label = suggestion.qualifiedPath.join(".")
Expand Down Expand Up @@ -410,7 +410,7 @@ proc main(ins: Stream, outs: Stream) =
file.close()

# Notify nimsuggest about a file modification.
discard getNimsuggest(req.fileuri).mod(req.filePath, dirtyfile = req.filestash)
discard getNimsuggest(req.fileuri).mod(req.filePath, req.filestash)
of "textDocument/didClose":
textDocumentNotification(message, DidCloseTextDocumentParams, req):
let projectFile = getProjectFile(uriToPath(req.fileuri))
Expand All @@ -432,7 +432,7 @@ proc main(ins: Stream, outs: Stream) =
openFiles[req.fileuri].fingerTable.add line.createUTFMapping()
file.writeLine line
file.close()
let diagnostics = getNimsuggest(req.fileuri).chk(req.filePath, dirtyfile = req.filestash)
let diagnostics = getNimsuggest(req.fileuri).chk(req.filePath, req.filestash)
debugLog "Got diagnostics: " & $diagnostics.len
debugSuggests(diagnostics[0..<min(diagnostics.len, 10)])
var response: seq[Diagnostic]
Expand Down Expand Up @@ -465,7 +465,7 @@ proc main(ins: Stream, outs: Stream) =
# Invoke chk on all open files.
let projectFile = openFiles[req.fileuri].projectFile
for f in projectFiles[projectFile].openFiles.items:
let diagnostics = getNimsuggest(f).chk(req.filePath, dirtyfile = req.filestash)
let diagnostics = getNimsuggest(f).chk(req.filePath, req.filestash)
debugLog "Got diagnostics: " & $diagnostics.len
debugSuggests(diagnostics[0 ..< min(diagnostics.len, 10)])

Expand Down

0 comments on commit c08ee60

Please sign in to comment.