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.2.0 to 2.2.1

64

lib/node/decorateLanguageService.js

@@ -319,3 +319,6 @@ "use strict";

let failed;
for (const generateOffset of (0, transform_1.forEachGeneratedOffset)(sourceScript, map, position, language_core_1.isRenameEnabled)) {
for (const [generateOffset, mapping] of (0, transform_1.toGeneratedOffsets)(sourceScript, map, position)) {
if (!(0, language_core_1.isRenameEnabled)(mapping.data)) {
continue;
}
const info = getRenameInfo(fileName, generateOffset, options);

@@ -533,40 +536,33 @@ if (info.canRename) {

if (serviceScript) {
let mainResult;
let additionalResults = [];
let isAdditional;
const generatedOffset = (0, transform_1.toGeneratedOffset)(sourceScript, map, position, data => {
if (!(0, language_core_1.isCompletionEnabled)(data)) {
return false;
const results = [];
for (const [generatedOffset, mapping] of (0, transform_1.toGeneratedOffsets)(sourceScript, map, position)) {
if (!(0, language_core_1.isCompletionEnabled)(mapping.data)) {
continue;
}
isAdditional = typeof data.completion === 'object' && data.completion.isAdditional;
if (!isAdditional && mainResult) {
return false;
}
return true;
});
if (generatedOffset !== undefined) {
const result = getCompletionsAtPosition(fileName, generatedOffset, options, formattingSettings);
if (result) {
for (const entry of result.entries) {
entry.replacementSpan = entry.replacementSpan && (0, transform_1.transformTextSpan)(sourceScript, map, entry.replacementSpan, language_core_1.isCompletionEnabled);
}
result.optionalReplacementSpan = result.optionalReplacementSpan && (0, transform_1.transformTextSpan)(sourceScript, map, result.optionalReplacementSpan, language_core_1.isCompletionEnabled);
if (isAdditional) {
additionalResults.push(result);
}
else {
mainResult = result;
}
if (!result || !result.entries.length) {
continue;
}
if (typeof mapping.data.completion === 'object' && mapping.data.completion.onlyImport) {
result.entries = result.entries.filter(entry => !!entry.sourceDisplay);
}
for (const entry of result.entries) {
entry.replacementSpan = entry.replacementSpan && (0, transform_1.transformTextSpan)(sourceScript, map, entry.replacementSpan, language_core_1.isCompletionEnabled);
}
result.optionalReplacementSpan = result.optionalReplacementSpan
&& (0, transform_1.transformTextSpan)(sourceScript, map, result.optionalReplacementSpan, language_core_1.isCompletionEnabled);
const isAdditional = typeof mapping.data.completion === 'object' && mapping.data.completion.isAdditional;
if (isAdditional) {
results.push(result);
}
else {
results.splice(0, 0, result);
}
}
if (!mainResult && additionalResults.length) {
mainResult = additionalResults.shift();
}
if (mainResult) {
if (results.length) {
return {
...mainResult,
entries: [
...mainResult.entries,
...additionalResults.map(additionalResult => additionalResult.entries).flat(),
],
...results[0],
entries: results
.map(additionalResult => additionalResult.entries)
.flat(),
};

@@ -573,0 +569,0 @@ }

@@ -16,2 +16,2 @@ import { Language, CodeInformation, SourceMap, SourceScript } from '@volar/language-core';

export declare function toGeneratedOffset(sourceScript: SourceScript, map: SourceMap, position: number, filter: (data: CodeInformation) => boolean): number | undefined;
export declare function forEachGeneratedOffset(sourceScript: SourceScript, map: SourceMap, position: number, filter: (data: CodeInformation) => boolean): Generator<number, void, unknown>;
export declare function toGeneratedOffsets(sourceScript: SourceScript, map: SourceMap<CodeInformation>, position: number): Generator<readonly [number, import("@volar/language-core").Mapping<CodeInformation>], void, unknown>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.forEachGeneratedOffset = exports.toGeneratedOffset = exports.toSourceOffset = exports.transformTextSpan = exports.transformTextChange = exports.transformSpan = exports.transformDocumentSpan = exports.transformFileTextChanges = exports.fillSourceFileText = exports.transformDiagnostic = exports.transformCallHierarchyItem = void 0;
exports.toGeneratedOffsets = exports.toGeneratedOffset = exports.toSourceOffset = exports.transformTextSpan = exports.transformTextChange = exports.transformSpan = exports.transformDocumentSpan = exports.transformFileTextChanges = exports.fillSourceFileText = exports.transformDiagnostic = exports.transformCallHierarchyItem = void 0;
const language_core_1 = require("@volar/language-core");

@@ -175,10 +175,8 @@ const utils_1 = require("./utils");

exports.toGeneratedOffset = toGeneratedOffset;
function* forEachGeneratedOffset(sourceScript, map, position, filter) {
function* toGeneratedOffsets(sourceScript, map, position) {
for (const [generateOffset, mapping] of map.getGeneratedOffsets(position)) {
if (filter(mapping.data)) {
yield generateOffset + sourceScript.snapshot.getLength();
}
yield [generateOffset + sourceScript.snapshot.getLength(), mapping];
}
}
exports.forEachGeneratedOffset = forEachGeneratedOffset;
exports.toGeneratedOffsets = toGeneratedOffsets;
//# sourceMappingURL=transform.js.map
{
"name": "@volar/typescript",
"version": "2.2.0",
"version": "2.2.1",
"license": "MIT",

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

"dependencies": {
"@volar/language-core": "2.2.0",
"@volar/language-core": "2.2.1",
"path-browserify": "^1.0.1"

@@ -22,5 +22,5 @@ },

"@types/path-browserify": "latest",
"@volar/language-service": "2.2.0"
"@volar/language-service": "2.2.1"
},
"gitHead": "c6e8d2765bbd2ec4a37374fd3a3a31c02661e8b3"
"gitHead": "629f686bda694077b236a0bcd0304437bb2eabf5"
}
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