Skip to content

Commit

Permalink
fix: trigger suggestion when using raw html class completion with tab #…
Browse files Browse the repository at this point in the history
  • Loading branch information
voorjaar committed May 22, 2021
1 parent facb31d commit 03439f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export default class Completions {
'"',
'\'',
':',
'!',
'(',
' ',
...(enableEmmet ? [ '.' ] : []),
Expand Down
10 changes: 9 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { resolve } from 'path';
import { Log } from '../utils/console';
import { getConfig, hex2RGB, flatColors } from '../utils';
import { allowAttr, fileTypes } from '../utils/filetypes';
import { Disposable, workspace, window } from 'vscode';
import { Disposable, workspace, window, commands } from 'vscode';

import type { JITI } from 'jiti';
import type { Attr } from './completions';
Expand Down Expand Up @@ -135,6 +135,14 @@ export default class Extension {
allowAttr(type) && disposables.push(completions.registerAttrKeys(ext, config.enableAttrUtility, config.enableAttrVariant));
allowAttr(type) && disposables.push(completions.registerAttrValues(ext, config.enableAttrUtility, config.enableVariant, config.enableDynamic));
}
// trigger suggestion when using raw html class completion with tab
disposables.push(window.onDidChangeTextEditorSelection((e) => {
if (e.kind === undefined) {
if(['class=""', 'className=""'].includes(e.textEditor.document.getText(e.textEditor.document.getWordRangeAtPosition(e.textEditor.selection.active, /[\w"=]+/)))) {
commands.executeCommand('editor.action.triggerSuggest');
}
}
}));
return disposables;
}

Expand Down

0 comments on commit 03439f9

Please sign in to comment.