@vue/language-service 1.7.3 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/helpers.d.ts +2 -2
- package/out/helpers.js +6 -6
- package/out/ideFeatures/nameCasing.js +3 -3
- package/out/index.d.ts +3 -2
- package/out/index.js +5 -4
- package/out/languageService.d.ts +4 -5
- package/out/languageService.js +24 -18
- package/out/plugins/vue-template.d.ts +7 -5
- package/out/plugins/vue-template.js +444 -448
- package/out/plugins/vue.d.ts +5 -5
- package/out/plugins/vue.js +11 -14
- package/package.json +15 -15
package/out/helpers.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
|
3
3
|
export declare function checkPropsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string, nativeTags: Set<string>, requiredOnly?: boolean): string[];
|
|
4
4
|
export declare function checkEventsOfTag(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, tag: string, nativeTags: Set<string>): string[];
|
|
5
5
|
export declare function checkComponentNames(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, sourceFile: embedded.VirtualFile, nativeTags: Set<string>): string[];
|
|
6
|
-
export declare function checkNativeTags(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService,
|
|
7
|
-
export declare function getElementAttrs(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService,
|
|
6
|
+
export declare function checkNativeTags(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, tsLsHost: ts.LanguageServiceHost): Set<string>;
|
|
7
|
+
export declare function getElementAttrs(ts: typeof import('typescript/lib/tsserverlibrary'), tsLs: ts.LanguageService, tsLsHost: ts.LanguageServiceHost, tagName: string): string[];
|
|
8
8
|
type Tags = Map<string, {
|
|
9
9
|
offsets: number[];
|
|
10
10
|
attrs: Map<string, {
|
package/out/helpers.js
CHANGED
|
@@ -120,12 +120,12 @@ function checkComponentNames(ts, tsLs, sourceFile, nativeTags) {
|
|
|
120
120
|
?? [];
|
|
121
121
|
}
|
|
122
122
|
exports.checkComponentNames = checkComponentNames;
|
|
123
|
-
function checkNativeTags(ts, tsLs,
|
|
124
|
-
const sharedTypesFileName =
|
|
123
|
+
function checkNativeTags(ts, tsLs, tsLsHost) {
|
|
124
|
+
const sharedTypesFileName = tsLsHost.getCurrentDirectory() + '/' + language_core_1.sharedTypes.baseName;
|
|
125
125
|
const result = new Set();
|
|
126
126
|
let tsSourceFile;
|
|
127
127
|
if (tsSourceFile = tsLs.getProgram()?.getSourceFile(sharedTypesFileName)) {
|
|
128
|
-
const typeNode = tsSourceFile.statements.find((node) => ts.isTypeAliasDeclaration(node) && node.name.getText() === '
|
|
128
|
+
const typeNode = tsSourceFile.statements.find((node) => ts.isTypeAliasDeclaration(node) && node.name.getText() === '__VLS_IntrinsicElements');
|
|
129
129
|
const checker = tsLs.getProgram()?.getTypeChecker();
|
|
130
130
|
if (checker && typeNode) {
|
|
131
131
|
const type = checker.getTypeFromTypeNode(typeNode.type);
|
|
@@ -138,11 +138,11 @@ function checkNativeTags(ts, tsLs, fileName) {
|
|
|
138
138
|
return result;
|
|
139
139
|
}
|
|
140
140
|
exports.checkNativeTags = checkNativeTags;
|
|
141
|
-
function getElementAttrs(ts, tsLs,
|
|
142
|
-
const sharedTypesFileName =
|
|
141
|
+
function getElementAttrs(ts, tsLs, tsLsHost, tagName) {
|
|
142
|
+
const sharedTypesFileName = tsLsHost.getCurrentDirectory() + '/' + language_core_1.sharedTypes.baseName;
|
|
143
143
|
let tsSourceFile;
|
|
144
144
|
if (tsSourceFile = tsLs.getProgram()?.getSourceFile(sharedTypesFileName)) {
|
|
145
|
-
const typeNode = tsSourceFile.statements.find((node) => ts.isTypeAliasDeclaration(node) && node.name.getText() === '
|
|
145
|
+
const typeNode = tsSourceFile.statements.find((node) => ts.isTypeAliasDeclaration(node) && node.name.getText() === '__VLS_IntrinsicElements');
|
|
146
146
|
const checker = tsLs.getProgram()?.getTypeChecker();
|
|
147
147
|
if (checker && typeNode) {
|
|
148
148
|
const type = checker.getTypeFromTypeNode(typeNode.type);
|
|
@@ -18,7 +18,7 @@ async function convertTagName(ts, context, uri, casing) {
|
|
|
18
18
|
const template = desc.template;
|
|
19
19
|
const document = context.documents.getDocumentByFileName(rootFile.snapshot, rootFile.fileName);
|
|
20
20
|
const edits = [];
|
|
21
|
-
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService,
|
|
21
|
+
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService, context.typescript.languageServiceHost);
|
|
22
22
|
const components = (0, helpers_1.checkComponentNames)(ts, context.typescript.languageService, rootFile, nativeTags);
|
|
23
23
|
const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
|
|
24
24
|
for (const [tagName, { offsets }] of tags) {
|
|
@@ -52,7 +52,7 @@ async function convertAttrName(ts, context, uri, casing) {
|
|
|
52
52
|
const template = desc.template;
|
|
53
53
|
const document = context.documents.getDocumentByFileName(rootFile.snapshot, rootFile.fileName);
|
|
54
54
|
const edits = [];
|
|
55
|
-
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService,
|
|
55
|
+
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService, context.typescript.languageServiceHost);
|
|
56
56
|
const components = (0, helpers_1.checkComponentNames)(ts, context.typescript.languageService, rootFile, nativeTags);
|
|
57
57
|
const tags = (0, helpers_1.getTemplateTagsAndAttrs)(rootFile);
|
|
58
58
|
for (const [tagName, { attrs }] of tags) {
|
|
@@ -137,7 +137,7 @@ function detect(ts, context, uri) {
|
|
|
137
137
|
if (!context.typescript) {
|
|
138
138
|
return [];
|
|
139
139
|
}
|
|
140
|
-
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService,
|
|
140
|
+
const nativeTags = (0, helpers_1.checkNativeTags)(ts, context.typescript.languageService, context.typescript.languageServiceHost);
|
|
141
141
|
const components = (0, helpers_1.checkComponentNames)(ts, context.typescript.languageService, file, nativeTags);
|
|
142
142
|
const tagNames = (0, helpers_1.getTemplateTagsAndAttrs)(file);
|
|
143
143
|
const result = [];
|
package/out/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from '@volar/language-service';
|
|
2
|
+
export * from '@vue/language-core';
|
|
2
3
|
export * from './ideFeatures/nameCasing';
|
|
3
4
|
export * from './languageService';
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
5
|
+
export { TagNameCasing, AttrNameCasing } from './types';
|
|
6
|
+
export { Provide } from './plugins/vue';
|
package/out/index.js
CHANGED
|
@@ -14,11 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.AttrNameCasing = exports.TagNameCasing = void 0;
|
|
18
18
|
__exportStar(require("@volar/language-service"), exports);
|
|
19
|
+
__exportStar(require("@vue/language-core"), exports);
|
|
19
20
|
__exportStar(require("./ideFeatures/nameCasing"), exports);
|
|
20
21
|
__exportStar(require("./languageService"), exports);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(exports, "
|
|
22
|
+
var types_1 = require("./types");
|
|
23
|
+
Object.defineProperty(exports, "TagNameCasing", { enumerable: true, get: function () { return types_1.TagNameCasing; } });
|
|
24
|
+
Object.defineProperty(exports, "AttrNameCasing", { enumerable: true, get: function () { return types_1.AttrNameCasing; } });
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/out/languageService.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Config } from '@volar/language-service';
|
|
2
2
|
import * as vue from '@vue/language-core';
|
|
3
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
4
|
-
import
|
|
4
|
+
import createJsonService from 'volar-service-json';
|
|
5
5
|
export interface Settings {
|
|
6
|
-
json?: Parameters<typeof
|
|
6
|
+
json?: Parameters<typeof createJsonService>[0];
|
|
7
7
|
}
|
|
8
|
-
export declare function resolveConfig(config: Config,
|
|
9
|
-
compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: vue.VueCompilerOptions, settings?: Settings, ts?: typeof import('typescript/lib/tsserverlibrary'), codegenStack?: boolean): Config;
|
|
8
|
+
export declare function resolveConfig(config: Config, compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<vue.VueCompilerOptions>, ts?: typeof import('typescript/lib/tsserverlibrary'), settings?: Settings, codegenStack?: boolean): Config;
|
package/out/languageService.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveConfig = void 0;
|
|
4
|
+
const vue = require("@vue/language-core");
|
|
5
|
+
const shared_1 = require("@vue/shared");
|
|
4
6
|
const volar_service_css_1 = require("volar-service-css");
|
|
5
7
|
const volar_service_emmet_1 = require("volar-service-emmet");
|
|
6
8
|
const volar_service_html_1 = require("volar-service-html");
|
|
7
9
|
const volar_service_json_1 = require("volar-service-json");
|
|
8
10
|
const volar_service_pug_1 = require("volar-service-pug");
|
|
11
|
+
const volar_service_pug_beautify_1 = require("volar-service-pug-beautify");
|
|
9
12
|
const volar_service_typescript_1 = require("volar-service-typescript");
|
|
10
13
|
const volar_service_typescript_twoslash_queries_1 = require("volar-service-typescript-twoslash-queries");
|
|
11
|
-
const vue = require("@vue/language-core");
|
|
12
14
|
const vscode = require("vscode-languageserver-protocol");
|
|
15
|
+
const nameCasing_1 = require("./ideFeatures/nameCasing");
|
|
13
16
|
const vue_1 = require("./plugins/vue");
|
|
14
17
|
const vue_autoinsert_dotvalue_1 = require("./plugins/vue-autoinsert-dotvalue");
|
|
18
|
+
const vue_autoinsert_parentheses_1 = require("./plugins/vue-autoinsert-parentheses");
|
|
19
|
+
const vue_autoinsert_space_1 = require("./plugins/vue-autoinsert-space");
|
|
15
20
|
const vue_codelens_references_1 = require("./plugins/vue-codelens-references");
|
|
16
|
-
const vue_twoslash_queries_1 = require("./plugins/vue-twoslash-queries");
|
|
17
21
|
const vue_template_1 = require("./plugins/vue-template");
|
|
22
|
+
const vue_twoslash_queries_1 = require("./plugins/vue-twoslash-queries");
|
|
18
23
|
const vue_visualize_hidden_callback_param_1 = require("./plugins/vue-visualize-hidden-callback-param");
|
|
19
|
-
const shared_1 = require("@vue/shared");
|
|
20
|
-
const volar_service_pug_beautify_1 = require("volar-service-pug-beautify");
|
|
21
|
-
const vue_autoinsert_parentheses_1 = require("./plugins/vue-autoinsert-parentheses");
|
|
22
|
-
const vue_autoinsert_space_1 = require("./plugins/vue-autoinsert-space");
|
|
23
24
|
const types_1 = require("./types");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const vueLanguageModules = vue.createLanguages(compilerOptions, vueCompilerOptions, ts, codegenStack);
|
|
25
|
+
function resolveConfig(config, compilerOptions = {}, vueCompilerOptions = {}, ts = require('typescript'), settings, codegenStack = false) {
|
|
26
|
+
const resolvedVueCompilerOptions = vue.resolveVueCompilerOptions(vueCompilerOptions);
|
|
27
|
+
const vueLanguageModules = vue.createLanguages(compilerOptions, resolvedVueCompilerOptions, ts, codegenStack);
|
|
28
28
|
config.languages = Object.assign({}, vueLanguageModules, config.languages);
|
|
29
|
-
config.services = resolvePlugins(config.services,
|
|
29
|
+
config.services = resolvePlugins(config.services, resolvedVueCompilerOptions, settings);
|
|
30
30
|
return config;
|
|
31
31
|
}
|
|
32
32
|
exports.resolveConfig = resolveConfig;
|
|
@@ -193,21 +193,27 @@ function resolvePlugins(services, vueCompilerOptions, settings) {
|
|
|
193
193
|
};
|
|
194
194
|
};
|
|
195
195
|
services.html ??= (0, vue_template_1.default)({
|
|
196
|
-
|
|
197
|
-
getScanner: (
|
|
198
|
-
return
|
|
196
|
+
baseService: (0, volar_service_html_1.default)(),
|
|
197
|
+
getScanner: (htmlService, document) => {
|
|
198
|
+
return htmlService.provide['html/languageService']().createScanner(document.getText());
|
|
199
|
+
},
|
|
200
|
+
updateCustomData(htmlService, extraData) {
|
|
201
|
+
htmlService.provide['html/updateCustomData'](extraData);
|
|
199
202
|
},
|
|
200
203
|
isSupportedDocument: (document) => document.languageId === 'html',
|
|
201
204
|
vueCompilerOptions,
|
|
202
205
|
});
|
|
203
206
|
services.pug ??= (0, vue_template_1.default)({
|
|
204
|
-
|
|
205
|
-
getScanner: (
|
|
206
|
-
const pugDocument =
|
|
207
|
+
baseService: (0, volar_service_pug_1.default)(),
|
|
208
|
+
getScanner: (pugService, document) => {
|
|
209
|
+
const pugDocument = pugService.provide['pug/pugDocument'](document);
|
|
207
210
|
if (pugDocument) {
|
|
208
|
-
return
|
|
211
|
+
return pugService.provide['pug/languageService']().createScanner(pugDocument);
|
|
209
212
|
}
|
|
210
213
|
},
|
|
214
|
+
updateCustomData(pugService, extraData) {
|
|
215
|
+
pugService.provide['pug/updateCustomData'](extraData);
|
|
216
|
+
},
|
|
211
217
|
isSupportedDocument: (document) => document.languageId === 'jade',
|
|
212
218
|
vueCompilerOptions,
|
|
213
219
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Service } from '@volar/language-service';
|
|
2
2
|
import * as html from 'vscode-html-languageservice';
|
|
3
3
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
import { VueCompilerOptions } from '../types';
|
|
5
|
-
|
|
6
|
-
getScanner(
|
|
7
|
-
|
|
5
|
+
declare const _default: <S extends Service>(options: {
|
|
6
|
+
getScanner(service: ReturnType<S>, document: TextDocument): html.Scanner | undefined;
|
|
7
|
+
updateCustomData(service: ReturnType<S>, extraData: html.IHTMLDataProvider[]): void;
|
|
8
|
+
baseService: S;
|
|
8
9
|
isSupportedDocument: (document: TextDocument) => boolean;
|
|
9
10
|
vueCompilerOptions: VueCompilerOptions;
|
|
10
|
-
})
|
|
11
|
+
}) => Service;
|
|
12
|
+
export default _default;
|