Skip to content
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

Change for loop, to instead use Array.forEach #44

Open
genius257 opened this issue Mar 4, 2024 · 0 comments
Open

Change for loop, to instead use Array.forEach #44

genius257 opened this issue Mar 4, 2024 · 0 comments

Comments

@genius257
Copy link
Owner

This is to prevent the use of ! in front of array indexed values

for (let index = 0; index < includes.length; index++) {
let script = workspace.get(includes[index]!);
if (script !== undefined) {
let _completionItems = script.declarations.reduce<CompletionItem[]>((completionItems, declaration) => {
switch (declaration.type) {
case "FunctionDeclaration":
completionItems.push({
label: declaration.id.name,
kind: CompletionItemKind.Function,
});
break;
case "VariableDeclarator":
completionItems.push({
label: "$" + declaration.id.name,
kind: CompletionItemKind.Variable,
insertText: "$" + declaration.id.name,
});
break;
}
return completionItems;
}, []);
completionItems.push(..._completionItems);
includes.push(...script.getIncludes().map(x => x.uri).filter((x):x is string => x!==null && !includes.includes(x)));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant