Skip to content

Commit

Permalink
Added source to completion items UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Aug 18, 2024
1 parent 457072c commit 02a4204
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/text/completion.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type
item*: CompletionItem
origin*: Option[tuple[line: int, column: RuneIndex]]
filterText*: string
source*: string
providerIndex: int
score*: float

Expand Down
1 change: 1 addition & 0 deletions src/text/completion_provider_document.nim
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ proc refilterCompletions(self: CompletionProviderDocument) {.async.} =
),
filterText: self.currentFilterText,
score: score,
source: "DOC",
)

if i < self.wordCache.len - 1 and loopTimer.elapsed.ms > 3:
Expand Down
1 change: 1 addition & 0 deletions src/text/completion_provider_lsp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ proc refilterCompletions(self: CompletionProviderLsp) =
item: item,
filterText: self.currentFilterText,
score: score,
source: "LSP",
)

if timer.elapsed.ms > 2:
Expand Down
1 change: 1 addition & 0 deletions src/text/completion_provider_snippet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ proc refilterCompletions(self: CompletionProviderSnippet) =
item: item,
filterText: self.currentFilterText,
score: score,
source: "SNP",
)

if timer.elapsed.ms > 2:
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widget_builder_text_document.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ proc createCompletions(self: TextDocumentEditor, builder: UINodeBuilder, app: Ap
detail[0..<(maxTypeLen - 3)] & "..."
else:
""
let scopeText = detail
let scopeText = completion.source & " " & detail
builder.panel(&{DrawText, SizeToContentX, SizeToContentY}, x = currentNode.w, pivot = vec2(0, 0), text = scopeText, textColor = scopeColor):
detailColumn.add currentNode
maxDetailWidth = max(maxDetailWidth, currentNode.w)
Expand Down

0 comments on commit 02a4204

Please sign in to comment.