-
Notifications
You must be signed in to change notification settings - Fork 7
fix: underscore autocompletion produces duplicated text #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking "Sign up for GitHub", you agree to our terms of service and privacy statement. We'll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: underscore autocompletion produces duplicated text #37
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -257,6 +257,43 @@ describe("prefixMatch", () => { | |||||
| expect(result).toBeInstanceOf(RegExp); | ||||||
| expect("a").toMatch(result as RegExp); | ||||||
| }); | ||||||
|
|
||||||
| it("should match partial prefix for underscore variables", () => { | ||||||
|
||||||
| it("should match partial prefix for underscore variables", () => { | |
| it("should handle typed text extending beyond common prefix", () => { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -307,9 +307,11 @@ export class LanguageServerPlugin implements PluginValue { | |
| const match = prefixMatch(items); | ||
|
|
||
| const token = match | ||
| ? context.matchBefore(match) | ||
| : // Fallback to matching any character | ||
| context.matchBefore(/[a-zA-Z0-9]+/); | ||
| ? // Try prefix-based match, then fall back to general word match | ||
| (context.matchBefore(match) ?? | ||
| context.matchBefore(/[a-zA-Z0-9_]+/)) | ||
| : // Fallback to matching any word character | ||
|
Comment on lines
309
to
+313
|
||
| context.matchBefore(/[a-zA-Z0-9_]+/); | ||
|
Comment on lines
309
to
+314
|
||
| let { pos } = context; | ||
|
|
||
| const sortedItems = sortCompletionItems( | ||
|
|
||