Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@volar/typescript

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volar/typescript - npm Package Compare versions

Comparing version 2.3.0-alpha.12 to 2.3.0-alpha.13

71

lib/node/decorateLanguageService.js

@@ -63,4 +63,4 @@ "use strict";

if (serviceScript) {
const generateStart = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, start, language_core_1.isFormattingEnabled);
const generateEnd = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, end, language_core_1.isFormattingEnabled);
const generateStart = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, start, language_core_1.isFormattingEnabled);
const generateEnd = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, end, language_core_1.isFormattingEnabled);
if (generateStart !== undefined && generateEnd !== undefined) {

@@ -85,3 +85,3 @@ const edits = getFormattingEditsForRange(targetScript.id, generateStart, generateEnd, options);

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isFormattingEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isFormattingEnabled);
if (generatePosition !== undefined) {

@@ -110,3 +110,3 @@ const edits = getFormattingEditsAfterKeystroke(targetScript.id, generatePosition, key, options);

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isLinkedEditingEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isLinkedEditingEnabled);
if (generatePosition !== undefined) {

@@ -130,3 +130,3 @@ const info = getLinkedEditingRangeAtPosition(targetScript.id, generatePosition);

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -136,3 +136,3 @@ return undefined;

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isCallHierarchyEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCallHierarchyEnabled);
if (generatePosition !== undefined) {

@@ -155,3 +155,3 @@ const item = prepareCallHierarchy(targetScript.id, generatePosition);

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -161,3 +161,3 @@ return [];

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isCallHierarchyEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCallHierarchyEnabled);
if (generatePosition !== undefined) {

@@ -190,5 +190,5 @@ calls = provideCallHierarchyIncomingCalls(targetScript.id, generatePosition);

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isCallHierarchyEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCallHierarchyEnabled);
if (generatePosition !== undefined) {
calls = provideCallHierarchyOutgoingCalls(fileName, generatePosition);
calls = provideCallHierarchyOutgoingCalls(targetScript.id, generatePosition);
}

@@ -225,3 +225,3 @@ }

const infos = [];
for (const [generatePosition] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, targetScript, position, language_core_1.isHoverEnabled)) {
for (const [generatePosition] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, sourceScript, position, language_core_1.isHoverEnabled)) {
const info = getQuickInfoAtPosition(targetScript.id, generatePosition);

@@ -288,3 +288,3 @@ if (info) {

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isSignatureHelpEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isSignatureHelpEnabled);
if (generatePosition !== undefined) {

@@ -339,3 +339,3 @@ const result = getSignatureHelpItems(targetScript.id, generatePosition, options);

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -345,3 +345,3 @@ return [];

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, typeof positionOrRange === 'number' ? positionOrRange : positionOrRange.pos, language_core_1.isCodeActionsEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, typeof positionOrRange === 'number' ? positionOrRange : positionOrRange.pos, language_core_1.isCodeActionsEnabled);
if (generatePosition !== undefined) {

@@ -365,3 +365,3 @@ const por = typeof positionOrRange === 'number'

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -371,3 +371,3 @@ return undefined;

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, typeof positionOrRange === 'number'
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, typeof positionOrRange === 'number'
? positionOrRange

@@ -404,3 +404,3 @@ : positionOrRange.pos, language_core_1.isCodeActionsEnabled);

let failed;
for (const [generateOffset] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, targetScript, position, language_core_1.isRenameEnabled)) {
for (const [generateOffset] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, sourceScript, position, language_core_1.isRenameEnabled)) {
const info = getRenameInfo(targetScript.id, generateOffset, options);

@@ -433,3 +433,3 @@ if (info.canRename) {

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -439,4 +439,4 @@ return [];

if (serviceScript) {
const generateStart = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, start, language_core_1.isCodeActionsEnabled);
const generateEnd = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, end, language_core_1.isCodeActionsEnabled);
const generateStart = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, start, language_core_1.isCodeActionsEnabled);
const generateEnd = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, end, language_core_1.isCodeActionsEnabled);
if (generateStart !== undefined && generateEnd !== undefined) {

@@ -510,5 +510,6 @@ fixes = getCodeFixesAtPosition(targetScript.id, generateStart, generateEnd, errorCodes, formatOptions, preferences);

}
return getSyntacticDiagnostics(fileName)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty);
return getSyntacticDiagnostics(targetScript?.id ?? fileName)
.map(d => (0, transform_1.transformDiagnostic)(language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty)
.filter(d => language.scripts.get(d.file.fileName) === sourceScript);
};

@@ -521,5 +522,6 @@ languageService.getSemanticDiagnostics = filePath => {

}
return getSemanticDiagnostics(fileName)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty);
return getSemanticDiagnostics(targetScript?.id ?? fileName)
.map(d => (0, transform_1.transformDiagnostic)(language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty)
.filter(d => !d.file || language.scripts.get(d.file.fileName) === sourceScript);
};

@@ -532,5 +534,6 @@ languageService.getSuggestionDiagnostics = filePath => {

}
return getSuggestionDiagnostics(fileName)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty);
return getSuggestionDiagnostics(targetScript?.id ?? fileName)
.map(d => (0, transform_1.transformDiagnostic)(language, d, languageService.getProgram(), false))
.filter(utils_1.notEmpty)
.filter(d => !d.file || language.scripts.get(d.file.fileName) === sourceScript);
};

@@ -656,3 +659,3 @@ languageService.getDefinitionAndBoundSpan = (filePath, position) => {

const results = [];
for (const [generatedOffset, mapping] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, targetScript, position, language_core_1.isCompletionEnabled)) {
for (const [generatedOffset, mapping] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, sourceScript, position, language_core_1.isCompletionEnabled)) {
const result = getCompletionsAtPosition(targetScript.id, generatedOffset, options, formattingSettings);

@@ -694,3 +697,3 @@ if (!result) {

const fileName = filePath.replace(windowsPathReg, '/');
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (targetScript?.associatedOnly) {

@@ -700,3 +703,3 @@ return undefined;

if (serviceScript) {
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, targetScript, position, language_core_1.isCompletionEnabled);
const generatePosition = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCompletionEnabled);
if (generatePosition !== undefined) {

@@ -769,5 +772,5 @@ details = getCompletionEntryDetails(targetScript.id, generatePosition, entryName, formatOptions, source, preferences, data);

const processedFilePositions = new Set();
const [serviceScript, targetScript] = (0, utils_1.getServiceScript)(language, fileName);
const [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
if (serviceScript) {
for (const [generatedOffset] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, targetScript, position, filter)) {
for (const [generatedOffset] of (0, transform_1.toGeneratedOffsets)(language, serviceScript, sourceScript, position, filter)) {
process(targetScript.id, generatedOffset);

@@ -774,0 +777,0 @@ }

@@ -21,3 +21,3 @@ "use strict";

diagnostics: result.diagnostics
.map(d => (0, transform_1.transformDiagnostic)(undefined, language, d, program, true))
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty),

@@ -29,3 +29,3 @@ };

return getSyntacticDiagnostics(undefined, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(undefined, language, d, program, true))
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty);

@@ -37,4 +37,5 @@ }

return getSyntacticDiagnostics(actualSourceFile, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, program, true))
.filter(utils_1.notEmpty);
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty)
.filter(d => !d.file || language.scripts.get(d.file.fileName) === sourceScript);
}

@@ -45,3 +46,3 @@ };

return getSemanticDiagnostics(undefined, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(undefined, language, d, program, true))
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty);

@@ -53,4 +54,5 @@ }

return getSemanticDiagnostics(actualSourceFile, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, program, true))
.filter(utils_1.notEmpty);
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty)
.filter(d => !d.file || language.scripts.get(d.file.fileName) === sourceScript);
}

@@ -60,3 +62,3 @@ };

return getGlobalDiagnostics(cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(undefined, language, d, program, true))
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty);

@@ -68,3 +70,3 @@ };

return getBindAndCheckDiagnostics(undefined, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(undefined, language, d, program, true))
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty);

@@ -76,4 +78,5 @@ }

return getBindAndCheckDiagnostics(actualSourceFile, cancellationToken)
.map(d => (0, transform_1.transformDiagnostic)(sourceScript, language, d, program, true))
.filter(utils_1.notEmpty);
.map(d => (0, transform_1.transformDiagnostic)(language, d, program, true))
.filter(utils_1.notEmpty)
.filter(d => language.scripts.get(d.file.fileName) === sourceScript);
}

@@ -80,0 +83,0 @@ };

@@ -5,3 +5,3 @@ import type { CodeInformation, SourceScript, TypeScriptServiceScript } from '@volar/language-core';

export declare function transformCallHierarchyItem(language: Language<string>, item: ts.CallHierarchyItem, filter: (data: CodeInformation) => boolean): ts.CallHierarchyItem;
export declare function transformDiagnostic<T extends ts.Diagnostic>(sourceScript: SourceScript<string> | undefined, language: Language<string>, diagnostic: T, program: ts.Program | undefined, isTsc: boolean): T | undefined;
export declare function transformDiagnostic<T extends ts.Diagnostic>(language: Language<string>, diagnostic: T, program: ts.Program | undefined, isTsc: boolean): T | undefined;
export declare function fillSourceFileText(language: Language<string>, sourceFile: ts.SourceFile): void;

@@ -8,0 +8,0 @@ export declare function transformFileTextChanges(language: Language<string>, changes: readonly ts.FileTextChanges[], filter: (data: CodeInformation) => boolean): ts.FileTextChanges[];

@@ -19,3 +19,3 @@ "use strict";

exports.transformCallHierarchyItem = transformCallHierarchyItem;
function transformDiagnostic(sourceScript, language, diagnostic, program, isTsc) {
function transformDiagnostic(language, diagnostic, program, isTsc) {
if (!transformedDiagnostics.has(diagnostic)) {

@@ -26,3 +26,3 @@ transformedDiagnostics.set(diagnostic, undefined);

diagnostic.relatedInformation = relatedInformation
.map(d => transformDiagnostic(undefined, language, d, program, isTsc))
.map(d => transformDiagnostic(language, d, program, isTsc))
.filter(utils_1.notEmpty);

@@ -35,3 +35,3 @@ }

if (serviceScript) {
const [sourceSpanFileName, sourceSpan] = transformTextSpan(sourceScript, language, serviceScript, {
const [sourceSpanFileName, sourceSpan] = transformTextSpan(undefined, language, serviceScript, {
start: diagnostic.start,

@@ -38,0 +38,0 @@ length: diagnostic.length

@@ -1,3 +0,6 @@

import { LanguagePlugin } from '@volar/language-core';
import { Language, LanguagePlugin } from '@volar/language-core';
import type * as ts from 'typescript';
export declare function createAsyncLanguageServicePlugin(extensions: string[], scriptKind: ts.ScriptKind, loadLanguagePlugins: (ts: typeof import('typescript'), info: ts.server.PluginCreateInfo) => Promise<LanguagePlugin<string>[]>): ts.server.PluginModuleFactory;
export declare function createAsyncLanguageServicePlugin(extensions: string[], scriptKind: ts.ScriptKind, create: (ts: typeof import('typescript'), info: ts.server.PluginCreateInfo) => Promise<{
languagePlugins: LanguagePlugin<string>[];
setup?: (language: Language<string>) => void;
}>): ts.server.PluginModuleFactory;

@@ -12,3 +12,3 @@ "use strict";

const decoratedLanguageServiceHosts = new WeakSet();
function createAsyncLanguageServicePlugin(extensions, scriptKind, loadLanguagePlugins) {
function createAsyncLanguageServicePlugin(extensions, scriptKind, create) {
return modules => {

@@ -56,3 +56,3 @@ const { typescript: ts } = modules;

}
loadLanguagePlugins(ts, info).then(languagePlugins => {
create(ts, info).then(({ languagePlugins, setup }) => {
const syncedScriptVersions = new language_core_1.FileMap(ts.sys.useCaseSensitiveFileNames);

@@ -78,2 +78,3 @@ const language = (0, language_core_1.createLanguage)([

(0, decorateLanguageServiceHost_1.decorateLanguageServiceHost)(ts, language, info.languageServiceHost);
setup?.(language);
info.project.markAsDirty();

@@ -80,0 +81,0 @@ initialized = true;

@@ -1,4 +0,7 @@

import { LanguagePlugin } from '@volar/language-core';
import { Language, LanguagePlugin } from '@volar/language-core';
import type * as ts from 'typescript';
export declare function createLanguageServicePlugin(loadLanguagePlugins: (ts: typeof import('typescript'), info: ts.server.PluginCreateInfo) => LanguagePlugin<string>[]): ts.server.PluginModuleFactory;
export declare function createLanguageServicePlugin(create: (ts: typeof import('typescript'), info: ts.server.PluginCreateInfo) => {
languagePlugins: LanguagePlugin<string>[];
setup?: (language: Language<string>) => void;
}): ts.server.PluginModuleFactory;
export declare function arrayItemsEqual(a: string[], b: string[]): boolean;

@@ -12,3 +12,3 @@ "use strict";

const decoratedLanguageServiceHosts = new WeakSet();
function createLanguageServicePlugin(loadLanguagePlugins) {
function createLanguageServicePlugin(create) {
return modules => {

@@ -22,3 +22,3 @@ const { typescript: ts } = modules;

decoratedLanguageServiceHosts.add(info.languageServiceHost);
const languagePlugins = loadLanguagePlugins(ts, info);
const { languagePlugins, setup } = create(ts, info);
const extensions = languagePlugins

@@ -50,2 +50,3 @@ .map(plugin => plugin.typescript?.extraFileExtensions.map(ext => '.' + ext.extension) ?? [])

(0, decorateLanguageServiceHost_1.decorateLanguageServiceHost)(ts, language, info.languageServiceHost);
setup?.(language);
}

@@ -52,0 +53,0 @@ return info.languageService;

{
"name": "@volar/typescript",
"version": "2.3.0-alpha.12",
"version": "2.3.0-alpha.13",
"license": "MIT",

@@ -15,3 +15,3 @@ "files": [

"dependencies": {
"@volar/language-core": "2.3.0-alpha.12",
"@volar/language-core": "2.3.0-alpha.13",
"path-browserify": "^1.0.1",

@@ -23,5 +23,5 @@ "vscode-uri": "^3.0.8"

"@types/path-browserify": "latest",
"@volar/language-service": "2.3.0-alpha.12"
"@volar/language-service": "2.3.0-alpha.13"
},
"gitHead": "750f23e9cebbc2262904c91600e631036eaec4d8"
"gitHead": "4effe4689ac845b17b7c821d50deda62c124f23b"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc