Skip to content

Commit

Permalink
fix: fix vue double dot
Browse files Browse the repository at this point in the history
  • Loading branch information
zitup committed Jul 22, 2020
1 parent ae3d825 commit a768abd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ out
node_modules
.vscode-test/
*.vsix
.DS_Store
13 changes: 5 additions & 8 deletions src/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,14 @@ function provideCompletionItems(
return classNames.map((ele: string) => {
return new vscode.CompletionItem(
// 提示内容要带上触发字符,https://github.com/Microsoft/vscode/issues/71662
`.${ele}`,
document.languageId === "vue" ? `${ele}` : `.${ele}`,
vscode.CompletionItemKind.Text
);
});
}

function getClass(path: string) {
const data: string = fs
.readFileSync(path, "utf8")
.split("\n")
.join("");
const data: string = fs.readFileSync(path, "utf8").split("\n").join("");

let result;
// htm/html/vue-->class
Expand All @@ -97,7 +94,7 @@ function resolveCompletionItem() {
return null;
}

export default function(context: vscode.ExtensionContext) {
export default function (context: vscode.ExtensionContext) {
// 注册代码建议提示,只有当按下“.”时才触发
context.subscriptions.push(
vscode.languages.registerCompletionItemProvider(
Expand All @@ -107,11 +104,11 @@ export default function(context: vscode.ExtensionContext) {
{ scheme: "file", language: "scss" },
{ scheme: "file", language: "sass" },
{ scheme: "file", language: "stylus" },
{ scheme: "file", language: "vue" }
{ scheme: "file", language: "vue" },
],
{
provideCompletionItems,
resolveCompletionItem
resolveCompletionItem,
},
"."
)
Expand Down

0 comments on commit a768abd

Please sign in to comment.