@volar/language-service
Advanced tools
Comparing version 2.3.0-alpha.3 to 2.3.0-alpha.4
@@ -13,6 +13,7 @@ "use strict"; | ||
} | ||
const embeddedRange = target.fragment.match(/^L(\d+)(,(\d+))?(-L(\d+)(,(\d+))?)?$/); | ||
const sourceScript = context.language.scripts.get(decoded[0]); | ||
const virtualCode = sourceScript?.generated?.embeddedCodes.get(decoded[1]); | ||
target = decoded[0]; | ||
const sourceScript = context.language.scripts.get(target); | ||
const virtualCode = sourceScript?.generated?.embeddedCodes.get(decoded[1]); | ||
if (virtualCode) { | ||
if (embeddedRange && virtualCode) { | ||
for (const map of context.documents.getMaps(virtualCode)) { | ||
@@ -22,31 +23,26 @@ if (!map.map.mappings.some(mapping => (0, language_core_1.isDocumentLinkEnabled)(mapping.data))) { | ||
} | ||
target = vscode_uri_1.URI.parse(map.sourceDocument.uri); | ||
const hash = target.fragment; | ||
const range = hash.match(/^L(\d+)(,(\d+))?(-L(\d+)(,(\d+))?)?$/); | ||
if (range) { | ||
const startLine = Number(range[1]) - 1; | ||
const startCharacter = Number(range[3] ?? 1) - 1; | ||
if (range[5] !== undefined) { | ||
const endLine = Number(range[5]) - 1; | ||
const endCharacter = Number(range[7] ?? 1) - 1; | ||
const sourceRange = map.getSourceRange({ | ||
start: { line: startLine, character: startCharacter }, | ||
end: { line: endLine, character: endCharacter }, | ||
const startLine = Number(embeddedRange[1]) - 1; | ||
const startCharacter = Number(embeddedRange[3] ?? 1) - 1; | ||
if (embeddedRange[5] !== undefined) { | ||
const endLine = Number(embeddedRange[5]) - 1; | ||
const endCharacter = Number(embeddedRange[7] ?? 1) - 1; | ||
const sourceRange = map.getSourceRange({ | ||
start: { line: startLine, character: startCharacter }, | ||
end: { line: endLine, character: endCharacter }, | ||
}); | ||
if (sourceRange) { | ||
target = target.with({ | ||
fragment: 'L' + (sourceRange.start.line + 1) + ',' + (sourceRange.start.character + 1) | ||
+ '-L' + (sourceRange.end.line + 1) + ',' + (sourceRange.end.character + 1), | ||
}); | ||
if (sourceRange) { | ||
target = target.with({ | ||
fragment: 'L' + (sourceRange.start.line + 1) + ',' + (sourceRange.start.character + 1) | ||
+ '-L' + (sourceRange.end.line + 1) + ',' + (sourceRange.end.character + 1), | ||
}); | ||
break; | ||
} | ||
break; | ||
} | ||
else { | ||
const sourcePos = map.getSourcePosition({ line: startLine, character: startCharacter }); | ||
if (sourcePos) { | ||
target = target.with({ | ||
fragment: 'L' + (sourcePos.line + 1) + ',' + (sourcePos.character + 1), | ||
}); | ||
break; | ||
} | ||
} | ||
else { | ||
const sourcePos = map.getSourcePosition({ line: startLine, character: startCharacter }); | ||
if (sourcePos) { | ||
target = target.with({ | ||
fragment: 'L' + (sourcePos.line + 1) + ',' + (sourcePos.character + 1), | ||
}); | ||
break; | ||
} | ||
@@ -53,0 +49,0 @@ } |
{ | ||
"name": "@volar/language-service", | ||
"version": "2.3.0-alpha.3", | ||
"version": "2.3.0-alpha.4", | ||
"license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.3.0-alpha.3", | ||
"@volar/language-core": "2.3.0-alpha.4", | ||
"vscode-languageserver-protocol": "^3.17.5", | ||
@@ -21,3 +21,3 @@ "vscode-languageserver-textdocument": "^1.0.11", | ||
}, | ||
"gitHead": "d322a122012dc339a3ac5139220e91649d508522" | ||
"gitHead": "8ab3ce02b06a410e9321eea3e9f23d36f97fedda" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201578
4066
+ Added@volar/language-core@2.3.0-alpha.4(transitive)
+ Added@volar/source-map@2.3.0-alpha.4(transitive)
- Removed@volar/language-core@2.3.0-alpha.3(transitive)
- Removed@volar/source-map@2.3.0-alpha.3(transitive)