Skip to content

Commit bf16f7c

Browse files
feat: 屏蔽 json/json5 文件中TS服务提供的无用跳转和补全 (#206)
* feat: 屏蔽 json/json5 文件中TS服务提供的无用跳转和补全 * docs(changeset): feat: 屏蔽 json/json5 文件中TS服务提供的无用跳转和补全 (#206)
1 parent cdf6933 commit bf16f7c

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

.changeset/tricky-signs-bathe.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@arkts/language-server": patch
3+
"vscode-naily-ets": patch
4+
---
5+
6+
feat: 屏蔽 json/json5 文件中 TS 服务提供的无用跳转和补全 (#206)

packages/language-server/src/patches/patch-semantic.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ export function patchSemantic(typescriptServices: LanguageServicePlugin[]): void
202202
},
203203

204204
async provideHover(document, position, token) {
205+
// 补丁:关闭 json 文件的悬浮提示功能
206+
if (document.languageId === 'json' || document.languageId === 'jsonc') return null
205207
// Hover补丁:提供注解装饰器的悬浮提示 (Decorator For Annotation)
206208
const annotationDecoratorHover = provideAnnotationDecoratorHover(document, document.offsetAt(position))
207209
if (annotationDecoratorHover) return annotationDecoratorHover
@@ -216,6 +218,12 @@ export function patchSemantic(typescriptServices: LanguageServicePlugin[]): void
216218
if (callExpressionHover) return callExpressionHover
217219
return instance.provideHover?.(document, position, token)
218220
},
221+
222+
async provideDefinition(document, position, token) {
223+
// 补丁:关闭 json 文件的跳转定义功能
224+
if (document.languageId === 'json' || document.languageId === 'jsonc') return null
225+
return instance.provideDefinition?.(document, position, token)
226+
},
219227
}
220228
}
221229
}

packages/vscode/src/project/routers/typed-router.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ declare module 'vue-router/auto-routes' {
5757
* @internal
5858
*/
5959
export interface _RouteFileInfoMap {
60-
'packages/vscode/src/project/pages/index.vue': {
60+
'src/project/pages/index.vue': {
6161
routes:
6262
| '/'
6363
views:
6464
| never
6565
}
66-
'packages/vscode/src/project/pages/template-detail.vue': {
66+
'src/project/pages/template-detail.vue': {
6767
routes:
6868
| '/template-detail'
6969
views:
7070
| never
7171
}
72-
'packages/vscode/src/project/pages/template-market.vue': {
72+
'src/project/pages/template-market.vue': {
7373
routes:
7474
| '/template-market'
7575
views:

0 commit comments

Comments
 (0)