Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor plugin code to typescript-plugin-service #295

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions packages/typescript-plugin-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
]
}
}
],
"types/3.x.d.ts": [
{
"format": "dts",
"file": "runtime/3.x.vuedx_runtime.d.ts"
}
]
},
"external": [
Expand Down Expand Up @@ -66,10 +72,22 @@
},
"homepage": "https://github.com/znck/vue-developer-experience#readme",
"dependencies": {
"@vuedx/projectconfig": "workspace:*",
"@vuedx/shared": "workspace:*",
"@vuedx/vue-languageservice": "workspace:*"
"@vuedx/template-ast-types": "workspace:*",
"@vuedx/vue-virtual-textdocument": "workspace:*",
"inversify": "^5.1.1",
"json5": "^2.2.0",
"node-ipc": "10.1.0",
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"typescript": "^4.6.3"
"csstype": "^3.1.0",
"@vuedx/compiler-tsx": "workspace:*",
"@types/web": "^0.0.56",
"@vue/runtime-core": "^3.2.39",
"quick-lru": "^6.0.1",
"vscode-languageserver-types": "^3.16.0",
"vue": "^3.2.39"
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const NAMESPACE = `package:@vuedx/vue-languageservice` as const
export const NAMESPACE = `package:@vuedx/typescript-plugin-vue` as const
export const TS_LANGUAGE_SERVICE = Symbol('Undecorated Language Service')
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { TextDocumentContentChangeEvent } from '@vuedx/vue-virtual-textdocument';
import type { TextDocumentContentChangeEvent } from '@vuedx/vue-virtual-textdocument'

export interface FilesystemProvider {
exists(fileName: string): boolean;
read(fileName: string): string;
exists(fileName: string): boolean
read(fileName: string): string
watch(
fileName: string,
onChange: (
changes: TextDocumentContentChangeEvent[],
version: number
) => void
): () => void;
version: number,
) => void,
): () => void
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface OffsetRangeLike {
start: number | undefined
length: number | undefined
}
12 changes: 7 additions & 5 deletions packages/typescript-plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ console.log =
console.trace =
() => {}

export type {
PluginConfig,
PluginSideChannel
} from '@vuedx/vue-languageservice'
import 'reflect-metadata'

import { Telemetry } from '@vuedx/shared'
import { pluginManager } from '@vuedx/vue-languageservice'
import * as Path from 'path'
import type { Modules, PluginCreateInfo, TS } from './interfaces'
import type { PluginConfig } from './managers/ConfigManager'
import { pluginManager } from './managers/PluginManager'
import { PluginSideChannel } from './services/PluginSideChannel'

export { PluginSideChannel }
export type { PluginConfig }

pluginManager.fixConsole(console)

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-plugin-vue/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PluginConfig } from '@vuedx/vue-languageservice'
import type * as TS from 'typescript/lib/tsserverlibrary'
import type { PluginConfig } from './managers/ConfigManager'

export { TS }
export interface Modules {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,9 @@ import type {
} from '../contracts/TypeScript'
import { CodeFixService } from '../features/CodeFixService'
import { CompletionsService } from '../features/CompletionsService'
import {
CssLanguageService,
LessLanguageService,
ScssLanguageService,
} from '../features/CssLanguageService'
import { DefinitionService } from '../features/DefinitionService'
import { DiagnosticsService } from '../features/DiagnosticsService'
import { FoldingRangeService } from '../features/FoldingRangeService'
import {
VueHtmlLanguageService,
VueSfcLanguageService,
} from '../features/HtmlLanguageService'
import { ImplementationService } from '../features/ImplementationService'
import { QuickInfoService } from '../features/QuickInfoService'
import { RefactorService } from '../features/RefactorService'
Expand All @@ -27,7 +18,6 @@ import { SignatureHelpService } from '../features/SignatureHelpService'
import { EncodedClassificationsService } from './EncodedClassificationsService'
import { FilesystemService } from './FilesystemService'
import { IPCService } from './IPCService'
import { LanguageServiceProvider } from './LanguageServiceProvider'
import { LoggerService } from './LoggerService'
import { TypescriptContextService } from './TypescriptContextService'

Expand Down Expand Up @@ -71,25 +61,7 @@ export class TypescriptPluginService
private readonly ts: TypescriptContextService,
@inject(IPCService)
private readonly ipc: IPCService,
@inject(LanguageServiceProvider)
private readonly languages: LanguageServiceProvider,
@inject(CssLanguageService)
css: CssLanguageService,
@inject(ScssLanguageService)
scss: ScssLanguageService,
@inject(LessLanguageService)
less: LessLanguageService,
@inject(VueHtmlLanguageService)
html: VueHtmlLanguageService,
@inject(VueSfcLanguageService)
sfc: VueSfcLanguageService,
) {
;[css, scss, less, html, sfc].forEach((service) => {
service.supportedLanguages.forEach((language) => {
this.languages.registerLanguageService(language, service)
})
})

if (Math.random() > 1) {
console.log([
this.classifications,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('v-text', () => {
let a = (null as unknown) as string | undefined
let a = null as unknown as string | undefined
VueDX.internal.checkDirective('text', 'div' as const, undefined, a, {})
})
2 changes: 1 addition & 1 deletion packages/typescript-plugin-vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/", "../global.d.ts"]
"include": ["src/", "../../@types", "../global.d.ts"]
}
33 changes: 1 addition & 32 deletions packages/vue-languageservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"buildConfig": {
"sources": {
"types/3.x.d.ts": [
{
"format": "dts",
"file": "lib/runtime/3.x.vuedx_runtime.d.ts"
},
{
"format": "dts",
"file": "../typescript-plugin-vue/runtime/3.x.vuedx_runtime.d.ts"
}
]
},
"external": [
"typescript",
"typescript/lib/tsserverlibrary",
"@vue/runtime-core"
]
},
"files": [
"lib/"
],
Expand All @@ -46,24 +27,12 @@
"url": "https://github.com/sponsors/znck"
},
"dependencies": {
"@vuedx/projectconfig": "workspace:*",
"@vuedx/shared": "workspace:*",
"@vuedx/template-ast-types": "workspace:*",
"@vuedx/vue-virtual-textdocument": "workspace:*",
"inversify": "^5.1.1",
"json5": "^2.2.0",
"node-ipc": "10.1.0",
"reflect-metadata": "^0.1.13",
"vscode-css-languageservice": "^5.1.13",
"vscode-html-languageservice": "^4.2.2"
},
"devDependencies": {
"csstype": "^3.1.0",
"@vuedx/compiler-tsx": "workspace:*",
"@types/web": "^0.0.56",
"@vue/runtime-core": "^3.2.39",
"quick-lru": "^6.0.1",
"vscode-languageserver-types": "^3.16.0",
"vue": "^3.2.39"
}
"devDependencies": {}
}

This file was deleted.

118 changes: 0 additions & 118 deletions packages/vue-languageservice/src/features/CssLanguageService.ts

This file was deleted.

Loading