Skip to content

Commit

Permalink
Fixed [#108]
Browse files Browse the repository at this point in the history
  • Loading branch information
thqby committed Jun 29, 2022
1 parent 5bb3c73 commit c50b5f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/src/completionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function completionProvider(params: CompletionParams, token: Cancel
if (triggerKind === 2)
return;
triggerchar = '';
} else {
} else if (content.pre.startsWith('#')) {
for (let i = 0; i < position.character; i++) {
char = lt.charAt(i);
if (quote === char) {
Expand Down Expand Up @@ -232,7 +232,7 @@ export async function completionProvider(params: CompletionParams, token: Cancel
let extreg = isdll ? new RegExp(/\.(dll|ocx|cpl)$/i) : inlib ? new RegExp(/\.ahk$/i) : new RegExp(/\.(ahk2?|ah2)$/i), ts = tt.replace(/['"<>]/g, '').replace(/^.*[\\/]/, '');
if (ts.includes('*'))
return undefined;
let expg = new RegExp((ts.match(/[^\w]/) ? ts.replace(/(.)/g, '$1.*') : '(' + ts.replace(/(.)/g, '$1.*') + '|[^\\w])').replace(/\.\./, '\\..'), 'i');
let ep = new RegExp((ts.match(/[^\w]/) ? ts.replace(/(.)/g, '$1.*') : '(' + ts.replace(/(.)/g, '$1.*') + '|[^\\w])').replace(/\.\./, '\\..'), 'i');
let textedit: TextEdit | undefined;
if (isdll)
paths = [(temp = doc.dlldir.get(position.line)) ? temp : doc.scriptpath, 'C:\\Windows\\System32'];
Expand All @@ -244,15 +244,15 @@ export async function completionProvider(params: CompletionParams, token: Cancel
for (let it of readdirSync(path)) {
try {
if (statSync(path + it).isDirectory()) {
if (expg.test(it)) {
if (ep.test(it)) {
additem(it, CompletionItemKind.Folder);
cpitem.command = { title: 'Trigger Suggest', command: 'editor.action.triggerSuggest' };
if (textedit)
cpitem.textEdit = Object.assign({}, textedit, { newText: cpitem.label + xg });
else
cpitem.insertText = cpitem.label + xg;
}
} else if (extreg.test(it) && expg.test(inlib ? it = it.replace(extreg, '') : it)) {
} else if (extreg.test(it) && ep.test(inlib ? it = it.replace(extreg, '') : it)) {
additem(it, CompletionItemKind.File);
if (textedit)
cpitem.textEdit = Object.assign({}, textedit, { newText: cpitem.label + lchar });
Expand Down

0 comments on commit c50b5f4

Please sign in to comment.