Skip to content

Commit

Permalink
feat: support jsx tags commenting
Browse files Browse the repository at this point in the history
close #1494
  • Loading branch information
johnsoncodehk committed Oct 22, 2022
1 parent 6d5264f commit ce4e78e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions extensions/vscode-vue-language-features/package.json
Expand Up @@ -176,6 +176,10 @@
"source.ts": "typescript",
"source.js.jsx": "javascriptreact",
"source.tsx": "typescriptreact",
"meta.tag.js": "jsx-tags",
"meta.tag.tsx": "jsx-tags",
"meta.tag.without-attributes.js": "jsx-tags",
"meta.tag.without-attributes.tsx": "jsx-tags",
"source.json": "json",
"source.json.comments": "jsonc",
"source.yaml": "yaml",
Expand Down Expand Up @@ -214,6 +218,10 @@
"source.ts": "typescript",
"source.js.jsx": "javascriptreact",
"source.tsx": "typescriptreact",
"meta.tag.js": "jsx-tags",
"meta.tag.tsx": "jsx-tags",
"meta.tag.without-attributes.js": "jsx-tags",
"meta.tag.without-attributes.tsx": "jsx-tags",
"source.json": "json",
"source.json.comments": "jsonc",
"source.yaml": "yaml",
Expand Down
4 changes: 3 additions & 1 deletion plugins/typescript/src/index.ts
Expand Up @@ -59,7 +59,9 @@ export default function (): LanguageServicePlugin {
if (config) {
const tsLs = context.typescript.languageService;
const close = tsLs.getJsxClosingTagAtPosition(shared.getPathOfUri(document.uri), document.offsetAt(position));
return close?.newText;
if (close) {
return '$0' + close.newText;
}
}
}
},
Expand Down

0 comments on commit ce4e78e

Please sign in to comment.