Skip to content

Commit

Permalink
Fix #4134 Add a new config intellisense.subsuperscript.enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Jan 15, 2024
1 parent 739a27b commit aa27787
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,12 @@
"default": false,
"markdownDescription": "When `\\` is typed, show unimath symbols in the dropdown selector."
},
"latex-workshop.intellisense.subsuperscript.enabled": {
"scope": "window",
"type": "boolean",
"default": false,
"markdownDescription": "Auto-complete sub- and super-scripts from the current project."
},
"latex-workshop.intellisense.package.enabled": {
"scope": "window",
"type": "boolean",
Expand Down
5 changes: 4 additions & 1 deletion src/completion/completer/subsuperscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export const subsuperscript = {
parse,
}

function from(result: RegExpMatchArray, _: CompletionArgs) {
function from(result: RegExpMatchArray, _: CompletionArgs): CompletionItem[] {
if (false === vscode.workspace.getConfiguration('latex-workshop').get('intellisense.subsuperscript.enabled') as boolean) {
return []
}
const isSub = result[0].startsWith('_')
let suggestions: CompletionItem[] = []
lw.cache.getIncludedTeX().forEach(cachedFile => {
Expand Down

0 comments on commit aa27787

Please sign in to comment.