Skip to content

Commit 32acd10

Browse files
committed
Fix language keywords completions to be case sensitive
1 parent 96d4c8d commit 32acd10

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [0.88.1]
4+
5+
* Fix language keywords completions to be case sensitive
6+
37
## [0.88.0]
48

59
* Add completions for Logtalk and Prolog built-in directives, predicates, and evaluable functors

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "logtalk-for-vscode",
33
"displayName": "Logtalk for VSCode",
44
"description": "Logtalk programming support",
5-
"version": "0.88.0",
5+
"version": "0.88.1",
66
"publisher": "LogtalkDotOrg",
77
"icon": "images/logtalk.png",
88
"license": "MIT",
@@ -1332,7 +1332,7 @@
13321332
"compile": "tsc -watch -p ./",
13331333
"test": "tsc ./tests/runTest.ts",
13341334
"vsix:make": "vsce package --baseImagesUrl https://raw.githubusercontent.com/llvm/llvm-project/master/clang-tools-extra/clangd/clients/clangd-vscode/",
1335-
"vsix:install": "code --install-extension logtalk-for-vscode-0.88.0.vsix"
1335+
"vsix:install": "code --install-extension logtalk-for-vscode-0.88.1.vsix"
13361336
},
13371337
"devDependencies": {
13381338
"@types/bluebird": "^3.5.38",

src/features/completionItemProvider.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,13 +1918,17 @@ export class LogtalkKeywordCompletionProvider implements CompletionItemProvider
19181918
}
19191919
}
19201920

1921-
// Extract the partial word being typed
1922-
const wordMatch = textBeforeCursor.match(/([a-z_][a-z0-9_]*)$/i);
1923-
const partialWord = wordMatch ? wordMatch[1].toLowerCase() : '';
1921+
// Extract the partial word being typed (case-sensitive: uppercase = variable in Logtalk)
1922+
const wordMatch = textBeforeCursor.match(/([a-z_][a-z0-9_]*)$/);
1923+
// If no lowercase word prefix found (e.g. user typed an uppercase variable), skip keyword completions
1924+
if (!wordMatch) {
1925+
return [];
1926+
}
1927+
const partialWord = wordMatch[1];
19241928

1925-
// Filter keywords that match the partial word
1929+
// Filter keywords that match the partial word (case-sensitive)
19261930
const filteredKeywords = LOGTALK_KEYWORDS.filter(kw =>
1927-
kw.name.toLowerCase().startsWith(partialWord)
1931+
kw.name.startsWith(partialWord)
19281932
);
19291933

19301934
// Create completion items

0 commit comments

Comments
 (0)