volar-service-pug
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -1,3 +0,3 @@ | ||
import type { ServicePlugin } from '@volar/language-service'; | ||
export declare function create(): ServicePlugin; | ||
import type { LanguageServicePlugin } from '@volar/language-service'; | ||
export declare function create(): LanguageServicePlugin; | ||
//# sourceMappingURL=empty.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { Disposable, DocumentSelector, Result, ServiceContext, ServicePlugin } from '@volar/language-service'; | ||
import type { Disposable, DocumentSelector, ProviderResult, ServiceContext, LanguageServicePlugin } from '@volar/language-service'; | ||
import type * as html from 'vscode-html-languageservice'; | ||
@@ -11,5 +11,5 @@ import type { TextDocument } from 'vscode-languageserver-textdocument'; | ||
documentSelector?: DocumentSelector; | ||
getCustomData?(context: ServiceContext): Result<html.IHTMLDataProvider[]>; | ||
getCustomData?(context: ServiceContext): ProviderResult<html.IHTMLDataProvider[]>; | ||
onDidChangeCustomData?(listener: () => void, context: ServiceContext): Disposable; | ||
}): ServicePlugin; | ||
}): LanguageServicePlugin; | ||
//# sourceMappingURL=index.d.ts.map |
16
index.js
@@ -26,3 +26,3 @@ "use strict"; | ||
provideCompletionItems(document, position, _) { | ||
return worker(document, (pugDocument) => { | ||
return worker(document, pugDocument => { | ||
return pugLs.doComplete(pugDocument, position, context, htmlService.provide['html/documentContext']()); | ||
@@ -55,3 +55,3 @@ }); | ||
provideDocumentHighlights(document, position) { | ||
return worker(document, (pugDocument) => { | ||
return worker(document, pugDocument => { | ||
return pugLs.findDocumentHighlights(pugDocument, position); | ||
@@ -61,3 +61,3 @@ }); | ||
provideDocumentLinks(document) { | ||
return worker(document, (pugDocument) => { | ||
return worker(document, pugDocument => { | ||
return pugLs.findDocumentLinks(pugDocument, htmlService.provide['html/documentContext']()); | ||
@@ -74,3 +74,3 @@ }); | ||
provideFoldingRanges(document) { | ||
return worker(document, (pugDocument) => { | ||
return worker(document, pugDocument => { | ||
return pugLs.getFoldingRanges(pugDocument); | ||
@@ -80,3 +80,3 @@ }); | ||
provideSelectionRanges(document, positions) { | ||
return worker(document, (pugDocument) => { | ||
return worker(document, pugDocument => { | ||
return pugLs.getSelectionRanges(pugDocument, positions); | ||
@@ -104,9 +104,11 @@ }); | ||
const pugDocument = getPugDocument(document); | ||
if (!pugDocument) | ||
if (!pugDocument) { | ||
return; | ||
} | ||
return callback(pugDocument); | ||
} | ||
function getPugDocument(document) { | ||
if (!matchDocument(documentSelector, document)) | ||
if (!matchDocument(documentSelector, document)) { | ||
return; | ||
} | ||
const cache = pugDocuments.get(document); | ||
@@ -113,0 +115,0 @@ if (cache) { |
@@ -158,4 +158,5 @@ "use strict"; | ||
function addClassesOrStyles(attrs, attrName) { | ||
if (!attrs.length) | ||
if (!attrs.length) { | ||
return; | ||
} | ||
codes.push(' '); | ||
@@ -185,4 +186,5 @@ codes.push(attrName); | ||
ends.push(pugTextDocument.offsetAt({ line: currentLine + 1, character: 0 }) - 1); | ||
if (currentLine <= 0) | ||
if (currentLine <= 0) { | ||
break; | ||
} | ||
currentLine--; | ||
@@ -206,7 +208,9 @@ prevLine = getLineText(pugTextDocument, currentLine); | ||
|| prevToken.type === 'outdent' | ||
|| prevToken.type === ':') | ||
|| prevToken.type === ':') { | ||
break; | ||
} | ||
tagStart = prevToken; | ||
if (prevToken.type === 'tag') | ||
if (prevToken.type === 'tag') { | ||
break; | ||
} | ||
} | ||
@@ -213,0 +217,0 @@ let prevToken = token; |
@@ -20,4 +20,5 @@ "use strict"; | ||
const htmlPos = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlPos) | ||
if (!htmlPos) { | ||
return; | ||
} | ||
const htmlComplete = documentContext ? await htmlLs.doComplete2(pugDoc.htmlTextDocument, htmlPos, pugDoc.htmlDocument, documentContext, options) : htmlLs.doComplete(pugDoc.htmlTextDocument, htmlPos, pugDoc.htmlDocument, options); | ||
@@ -24,0 +25,0 @@ return (0, language_service_1.transformCompletionList)(htmlComplete, htmlRange => pugDoc.map.getSourceRange(htmlRange), pugDoc.map.embeddedDocument, serviceContext); |
@@ -8,4 +8,5 @@ "use strict"; | ||
const htmlPos = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlPos) | ||
if (!htmlPos) { | ||
return; | ||
} | ||
const htmlResult = htmlLs.findDocumentHighlights(pugDoc.map.embeddedDocument, htmlPos, pugDoc.htmlDocument); | ||
@@ -12,0 +13,0 @@ return (0, language_service_1.transformLocations)(htmlResult, htmlRange => pugDoc.map.getSourceRange(htmlRange)); |
@@ -8,7 +8,9 @@ "use strict"; | ||
const htmlPos = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlPos) | ||
if (!htmlPos) { | ||
return; | ||
} | ||
const htmlResult = htmlLs.doHover(pugDoc.map.embeddedDocument, htmlPos, pugDoc.htmlDocument, options); | ||
if (!htmlResult) | ||
if (!htmlResult) { | ||
return; | ||
} | ||
return (0, language_service_1.transformHover)(htmlResult, htmlRange => pugDoc.map.getSourceRange(htmlRange)); | ||
@@ -15,0 +17,0 @@ }; |
@@ -7,4 +7,5 @@ "use strict"; | ||
const htmlStart = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlStart) | ||
if (!htmlStart) { | ||
return; | ||
} | ||
const text = htmlLs.doQuoteComplete(pugDoc.htmlTextDocument, htmlStart, pugDoc.htmlDocument, options); | ||
@@ -11,0 +12,0 @@ return text; |
@@ -10,4 +10,5 @@ "use strict"; | ||
?.generatedOffsets[0]; | ||
if (htmlOffset === undefined) | ||
if (htmlOffset === undefined) { | ||
return; | ||
} | ||
const htmlScanner = htmlLs.createScanner(pugDoc.htmlTextDocument.getText(), htmlOffset); | ||
@@ -14,0 +15,0 @@ // @ts-expect-error |
{ | ||
"name": "volar-service-pug", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"description": "Integrate Pug into Volar", | ||
@@ -27,6 +27,6 @@ "homepage": "https://github.com/volarjs/services/tree/master/packages/pug", | ||
"dependencies": { | ||
"@volar/language-service": "~2.1.0", | ||
"@volar/language-service": "~2.2.0-alpha.0", | ||
"pug-lexer": "^5.0.1", | ||
"pug-parser": "^6.0.0", | ||
"volar-service-html": "0.0.34", | ||
"volar-service-html": "0.0.35", | ||
"vscode-html-languageservice": "^5.1.0", | ||
@@ -41,3 +41,3 @@ "vscode-languageserver-textdocument": "^1.0.11" | ||
}, | ||
"gitHead": "aafefd1d65541462b3e99208f14dbb2cd8477ae9" | ||
"gitHead": "cbd8ef0ada6eae9656286535599c9b289134d1e3" | ||
} |
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
38546
828
+ Added@volar/language-core@2.2.5(transitive)
+ Added@volar/language-service@2.2.5(transitive)
+ Added@volar/source-map@2.2.5(transitive)
+ Addedvolar-service-html@0.0.35(transitive)
- Removed@volar/language-core@2.1.6(transitive)
- Removed@volar/language-service@2.1.6(transitive)
- Removed@volar/source-map@2.1.6(transitive)
- Removedvolar-service-html@0.0.34(transitive)
Updatedvolar-service-html@0.0.35