vscode-pug-languageservice
Advanced tools
Comparing version 0.25.2 to 0.25.3
@@ -112,7 +112,6 @@ import type * as html from 'vscode-html-languageservice'; | ||
scan: () => html.TokenType; | ||
getTokenType: () => html.TokenType; | ||
getTokenOffset: () => number; | ||
getTokenLength: () => number; | ||
getTokenEnd: () => number; | ||
getTokenText: () => string; | ||
getTokenLength: () => number; | ||
getTokenError: () => string | undefined; | ||
@@ -119,0 +118,0 @@ getScannerState: () => html.ScannerState; |
@@ -5,9 +5,8 @@ import * as html from 'vscode-html-languageservice'; | ||
scan: () => html.TokenType; | ||
getTokenType: () => html.TokenType; | ||
getTokenOffset: () => number; | ||
getTokenLength: () => number; | ||
getTokenEnd: () => number; | ||
getTokenText: () => string; | ||
getTokenLength: () => number; | ||
getTokenError: () => string | undefined; | ||
getScannerState: () => html.ScannerState; | ||
} | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.register = void 0; | ||
const html = require("vscode-html-languageservice"); | ||
function register(htmlLs) { | ||
@@ -15,28 +14,37 @@ return (pugDoc, initialOffset = 0) => { | ||
const htmlScanner = htmlLs.createScanner(pugDoc.htmlCode, htmlRange.start); | ||
let token = html.TokenType.Unknown; | ||
let offset = 0; | ||
let end = 0; | ||
let offset; | ||
let end; | ||
return { | ||
scan, | ||
getTokenType: () => token, | ||
getTokenOffset: () => offset, | ||
scan: () => { | ||
offset = undefined; | ||
end = undefined; | ||
return htmlScanner.scan(); | ||
}, | ||
getTokenOffset: () => { | ||
getTokenRange(); | ||
return offset; | ||
}, | ||
getTokenEnd: () => { | ||
getTokenRange(); | ||
return end; | ||
}, | ||
getTokenText: htmlScanner.getTokenText, | ||
getTokenLength: htmlScanner.getTokenLength, | ||
getTokenEnd: () => end, | ||
getTokenText: () => pugDoc.pugCode.substring(offset, end), | ||
getTokenError: htmlScanner.getTokenError, | ||
getScannerState: htmlScanner.getScannerState, | ||
}; | ||
function scan() { | ||
token = htmlScanner.scan(); | ||
const htmlOffset = htmlScanner.getTokenOffset(); | ||
const htmlEnd = htmlScanner.getTokenEnd(); | ||
const pugRange = pugDoc.sourceMap.getSourceRange2(htmlOffset, htmlEnd); | ||
if (pugRange) { | ||
offset = pugRange.start; | ||
end = pugRange.end; | ||
return token; | ||
function getTokenRange() { | ||
if (offset === undefined || end === undefined) { | ||
const htmlOffset = htmlScanner.getTokenOffset(); | ||
const htmlEnd = htmlScanner.getTokenEnd(); | ||
const pugRange = pugDoc.sourceMap.getSourceRange2(htmlOffset, htmlEnd); | ||
if (pugRange) { | ||
offset = pugRange.start; | ||
end = pugRange.end; | ||
} | ||
else { | ||
offset = -1; | ||
end = -1; | ||
} | ||
} | ||
else { | ||
return html.TokenType.Unknown; | ||
} | ||
} | ||
@@ -43,0 +51,0 @@ }; |
{ | ||
"name": "vscode-pug-languageservice", | ||
"version": "0.25.2", | ||
"version": "0.25.3", | ||
"main": "out/index.js", | ||
"license": "MIT", | ||
"files": [ | ||
"out" | ||
"out/**/*.js", | ||
"out/**/*.d.ts" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/johnsoncodehk/volar.git" | ||
"url": "https://github.com/johnsoncodehk/volar.git", | ||
"directory": "packages/vscode-pug-languageservice" | ||
}, | ||
@@ -17,6 +20,6 @@ "devDependencies": { | ||
"dependencies": { | ||
"@volar/code-gen": "^0.25.2", | ||
"@volar/shared": "^0.25.2", | ||
"@volar/source-map": "^0.25.2", | ||
"@volar/transforms": "^0.25.2", | ||
"@volar/code-gen": "^0.25.3", | ||
"@volar/shared": "^0.25.3", | ||
"@volar/source-map": "^0.25.3", | ||
"@volar/transforms": "^0.25.3", | ||
"pug-beautify": "^0.1.1", | ||
@@ -27,3 +30,3 @@ "pug-lexer": "^5.0.1", | ||
}, | ||
"gitHead": "58854fa21cbf3f4e6f1cc7c2100c2c6cebbdd394" | ||
"gitHead": "0c789d67b90c30378b978852e8a6a5321e03cc29" | ||
} |
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
0
507
23627
20
Updated@volar/code-gen@^0.25.3
Updated@volar/shared@^0.25.3
Updated@volar/source-map@^0.25.3
Updated@volar/transforms@^0.25.3