8000 feat(vscode): add `vue.hover.rich` setting · vuejs/language-tools@a1f0e8c · GitHub
[go: up one dir, main page]

Skip to content

Commit a1f0e8c

Browse files
committed
feat(vscode): add vue.hover.rich setting
1 parent 3417c37 commit a1f0e8c

File tree

7 files changed

+12
-1
lines changed

7 files changed

+12
-1
lines changed

extensions/vscode/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@
298298
"default": true,
299299
"markdownDescription": "%configuration.codeActions.askNewComponentName%"
300300
},
301+
"vue.hover.rich": {
302+
"type": "boolean",
303+
"default": false,
304+
"markdownDescription": "%configuration.hover.rich%"
305+
},
301306
"vue.suggest.componentNameCasing": {
302307
"type": "string",
303308
"enum": [
Collapse file

extensions/vscode/package.nls.ja.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"configuration.suggest.componentNameCasing": "コンポーネント名の命名規則。",
77
"configuration.suggest.propNameCasing": "属性名の命名規則。",
88
"configuration.suggest.defineAssignment": "補完項目 `props` を選択した時に `const props = ` を `defineProps` の前に自動で追加します。(`emit` と `slots` も同様)",
9+
"configuration.hover.rich": "(実験的)型情報を使用して Vue コンポーネントのリッチホバーを有効にします(props、events、slots、exposed をテーブル形式で表示)。",
910
"configuration.autoInsert.dotValue": "Ref 値に `.value` を自動で追加します。",
1011
"configuration.autoInsert.bracketSpacing": "二重中括弧で括られた内側にスペースを自動で追加します。",
1112
"configuration.inlayHints.destructuredProps": "分割代入された props のインレイヒントを表示します:\n\n```ts\nwatch(() => /* props. */foo, () => { ... });\n```",

extensions/vscode/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"configuration.server.path": "Path to the `@vue/language-server` module. If not set, the server will be loaded from the extension's bundled.",
44
"configuration.server.includeLanguages": "Configure the languages for which the extension should be activated.",
55
"configuration.codeActions.askNewComponentName": "Ask for new component name when extract component.",
6+
"configuration.hover.rich": "(Experimental) Enable rich hover for Vue components using type information (show props, events, slots, exposed in table format).",
67
"configuration.suggest.componentNameCasing": "Preferred component name case.",
78
"configuration.suggest.propNameCasing": "Preferred attr name case.",
89
"configuration.suggest.defineAssignment": "Auto add `const props = ` before `defineProps` when selecting the completion item `props`. (also `emit` and `slots`)",

extensions/vscode/package.nls.ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"configuration.suggest.componentNameCasing": "Предпочитаемый формат имени компонента.",
77
"configuration.suggest.propNameCasing": "Предпочитаемый формат имени атрибута.",
88
"configuration.suggest.defineAssignment": "Автоматически добавлять `const props = ` перед `defineProps` при выборе элемента завершения `props`. (также `emit` и `slots`)",
9+
"configuration.hover.rich": "(Экспериментально) Включить расширенный hover для компонентов Vue с использованием информации о типах (отображение props, events, slots, exposed в виде таблицы).",
910
"configuration.autoInsert.dotValue": "Автоматически добавлять `.value` при вводе реактивной переменной",
1011
"configuration.autoInsert.bracketSpacing": "Автоматически добавлять пробелы между двойными фигурными скобками: `{{|}}` -> `{{ | }}`",
1112
"configuration.inlayHints.destructuredProps": "Отображать подсказки для деструктурированных props:\n\n```ts\nwatch(() => /* props. */foo, () => { ... });\n```",

extensions/vscode/package.nls.zh-CN.json

Lines changed: 1 addition & 0 deletions
< 8000 div data-testid="neutral diffstat" class="DiffSquares-module__diffSquare--KZMTU DiffSquares-module__neutral--_tGgY">
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"configuration.server.path": "`@vue/language-server` 模块的路径。如果未设置,服务器将从扩展的捆绑包中加载。",
44
"configuration.server.includeLanguages": "配置扩展需要激活的语言类型。",
55
"configuration.codeActions.askNewComponentName": "提取组件时询问新组件名称。",
6+
"configuration.hover.rich": "(实验性)使用类型信息为 Vue 组件启用丰富悬停(以表格形式显示 props、events、slots、exposed)。",
67
"configuration.suggest.componentNameCasing": "首选组件命名格式。",
78
"configuration.suggest.propNameCasing": "首选属性命名格式。",
89
"configuration.suggest.defineAssignment": "当选择补全项 `props` 时,自动在 `defineProps` 前添加 `const props = `(也包括 `emit` 和 `slots`)。",

extensions/vscode/package.nls.zh-TW.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"configuration.suggest.componentNameCasing": "首選元件名稱格式。",
77
"configuration.suggest.propNameCasing": "首選屬性名稱格式。",
88
"configuration.suggest.defineAssignment": "選取補全項目 `props` 時,自動在 `defineProps` 前添加 `const props = `(也包括 `emit` 和 `slots`)。",
9+
"configuration.hover.rich": "(實驗性)使用型別資訊為 Vue 元件啟用豐富懸停(以表格格式顯示 props、events、slots、exposed)。",
910
"configuration.autoInsert.dotValue": "當輸入響應式變量時,自動補全 `.value`。",
1011
"configuration.autoInsert.bracketSpacing": "在雙花括號之間自動添加空格: `{{|}}` -> `{{ | }}`",
1112
"configuration.inlayHints.destructuredProps": "顯示解構 props 的內嵌提示:\n\n```ts\nwatch(() => /* props. */foo, () => { ... });\n```",

packages/language-service/lib/plugins/vue-template.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,9 @@ export function create(
444444
() => baseServiceInstance.provideHover!(document, position, token),
445445
);
446446
const templateAst = info.root.sfc.template?.ast;
447+
const enabledRichMessage = await context.env.getConfiguration?.('vue.hover.rich');
447448

448-
if (!templateAst || (htmlHover && hasContents(htmlHover.contents))) {
449+
if (!templateAst || !enabledRichMessage || (htmlHover && hasContents(htmlHover.contents))) {
449450
return htmlHover;
450451
}
451452

0 commit comments

Comments
 (0)
0