diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f25d6c..31163e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,19 @@ # Release Notes +## v0.1.2 (2025-05-15) +- 🐛 Fixed bug with autocompletion not working properly on vscode editor + ## v0.1.1 (2025-05-12) -- Fixed issue with autocompletion not working properly in some cases +- 🐛 Fixed bug with autocompletion not working properly in some cases ## v0.1.0 (2025-05-03) -- Added `build.yml` file for GitHub actions to build releases with all LSP binaries +- ✨ Added `build.yml` file for GitHub actions to build releases with all LSP binaries ## v0.0.2 (2025-04-25) -- Improved logger -- Add generating `build-version` file to `bin` directory +- ✨ Improved logger +- ✨ Added generating `build-version` file to `bin` directory ## v0.0.1 (2025-04-16) -- Added completions for directives -- Added showing hover information for directives +- ✨ Added completions for directives +- ✨ Added showing hover information for directives diff --git a/Makefile b/Makefile index ddb4467..f6ff08c 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,8 @@ push: git push @echo "✅ Pushed to GitHub!" +.PHONE: build +build: + go build main.go + .DEFAULT_GOAL := test diff --git a/analysis/completion.go b/analysis/completion.go index f4d0a6c..0e729ee 100644 --- a/analysis/completion.go +++ b/analysis/completion.go @@ -1,7 +1,6 @@ package analysis import ( - "regexp" "strings" "github.com/textwire/lsp/lsp" @@ -20,19 +19,6 @@ func (s *State) Completion(id int, uri string, pos lsp.Position) (lsp.Completion return s.completionResponse(id, nil), nil } - line := lines[pos.Line] - cursorPos := int(pos.Character) - textBeforeCursor := line[:cursorPos] - - directiveRegex := regexp.MustCompile(`(^|[^\\])@(\w*)$`) - directiveMatch := directiveRegex.FindStringSubmatch(textBeforeCursor) - - if directiveMatch == nil { - return s.completionResponse(id, []lsp.CompletionItem{}), nil - } - - directiveName := directiveMatch[2] - directives, err := completions.GetDirectives("en") if err != nil { return lsp.CompletionResponse{}, err @@ -41,12 +27,9 @@ func (s *State) Completion(id int, uri string, pos lsp.Position) (lsp.Completion items := make([]lsp.CompletionItem, 0, len(directives)) for _, dir := range directives { - if !strings.HasPrefix(dir.Insert, directiveName) { - continue - } - items = append(items, lsp.CompletionItem{ Label: dir.Label, + FilterText: dir.Insert, InsertText: dir.Insert, Documentation: dir.Documentation, LabelDetails: &lsp.CompletionItemLabelDetails{ diff --git a/lsp/textdocument_completion.go b/lsp/textdocument_completion.go index a660fed..25630a5 100644 --- a/lsp/textdocument_completion.go +++ b/lsp/textdocument_completion.go @@ -73,6 +73,11 @@ type CompletionItem struct { // be an unqualified name of the completion item. Label string `json:"label"` + // A string that should be used when filtering a set of + // completion items. When omitted the label is used as the + // filter text for this item. + FilterText string `json:"filterText,omitempty"` + // LabelDetails is additional details for the label. LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`