@volar/shared
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -1,3 +0,1 @@ | ||
import type * as vscode from 'vscode-languageserver-protocol'; | ||
import type { TextDocument } from 'vscode-languageserver-textdocument'; | ||
export declare function sleep(ms: number): Promise<unknown>; | ||
@@ -7,9 +5,1 @@ export declare function syntaxToLanguageId(syntax: string): string; | ||
export declare function notEmpty<T>(value: T | null | undefined): value is T; | ||
export declare function isInsideRange(parent: vscode.Range, child: vscode.Range): boolean; | ||
export declare function getWordRange(wordPattern: RegExp, position: vscode.Position, document: TextDocument): vscode.Range | undefined; | ||
export declare function getOverlapRange(range1: vscode.Range, range2: vscode.Range): vscode.Range | undefined; | ||
export declare function getOverlapRange2(range1Start: number, range1End: number, range2Start: number, range2End: number): { | ||
start: number; | ||
end: number; | ||
} | undefined; | ||
export declare function getLineText(document: TextDocument, line: number): string; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLineText = exports.getOverlapRange2 = exports.getOverlapRange = exports.getWordRange = exports.isInsideRange = exports.notEmpty = exports.languageIdToSyntax = exports.syntaxToLanguageId = exports.sleep = void 0; | ||
exports.notEmpty = exports.languageIdToSyntax = exports.syntaxToLanguageId = exports.sleep = void 0; | ||
function sleep(ms) { | ||
@@ -39,77 +39,2 @@ return new Promise(resolve => setTimeout(resolve, ms)); | ||
exports.notEmpty = notEmpty; | ||
function isInsideRange(parent, child) { | ||
if (child.start.line < parent.start.line) | ||
return false; | ||
if (child.end.line > parent.end.line) | ||
return false; | ||
if (child.start.line === parent.start.line && child.start.character < parent.start.character) | ||
return false; | ||
if (child.end.line === parent.end.line && child.end.character > parent.end.character) | ||
return false; | ||
return true; | ||
} | ||
exports.isInsideRange = isInsideRange; | ||
function getWordRange(wordPattern, position, document) { | ||
const lineStart = { | ||
line: position.line, | ||
character: 0, | ||
}; | ||
const lineEnd = { | ||
line: position.line + 1, | ||
character: 0, | ||
}; | ||
const offset = document.offsetAt(position); | ||
const lineStartOffset = document.offsetAt(lineStart); | ||
const lineText = document.getText({ start: lineStart, end: lineEnd }); | ||
for (const match of lineText.matchAll(wordPattern)) { | ||
if (match.index === undefined) | ||
continue; | ||
const matchStart = match.index + lineStartOffset; | ||
const matchEnd = matchStart + match[0].length; | ||
if (offset >= matchStart && offset <= matchEnd) { | ||
return { | ||
start: document.positionAt(matchStart), | ||
end: document.positionAt(matchEnd), | ||
}; | ||
} | ||
} | ||
return undefined; | ||
} | ||
exports.getWordRange = getWordRange; | ||
function getOverlapRange(range1, range2) { | ||
const start = { | ||
line: Math.max(range1.start.line, range2.start.line), | ||
character: range1.start.line === range2.start.line ? Math.max(range1.start.character, range2.start.character) : range1.start.line > range2.start.line ? range1.start.character : range2.start.character, | ||
}; | ||
const end = { | ||
line: Math.min(range1.end.line, range2.end.line), | ||
character: range1.end.line === range2.end.line ? Math.min(range1.end.character, range2.end.character) : range1.end.line < range2.end.line ? range1.end.character : range2.end.character, | ||
}; | ||
if (start.line > end.line || (start.line === end.line && start.character > end.character)) | ||
return undefined; | ||
return { | ||
start, | ||
end, | ||
}; | ||
} | ||
exports.getOverlapRange = getOverlapRange; | ||
function getOverlapRange2(range1Start, range1End, range2Start, range2End) { | ||
const start = Math.max(range1Start, range2Start); | ||
const end = Math.min(range1End, range2End); | ||
if (start > end) | ||
return undefined; | ||
return { | ||
start, | ||
end, | ||
}; | ||
} | ||
exports.getOverlapRange2 = getOverlapRange2; | ||
function getLineText(document, line) { | ||
const text = document.getText({ | ||
start: { line: line, character: 0 }, | ||
end: { line: line + 1, character: 0 }, | ||
}); | ||
return text.slice(0, -1); | ||
} | ||
exports.getLineText = getLineText; | ||
//# sourceMappingURL=common.js.map |
export * from './common'; | ||
export * from './ts'; | ||
export * from './path'; | ||
export * from './uriMap'; | ||
export * as _1 from 'vscode-languageserver-textdocument'; | ||
export * as _2 from 'vscode-uri'; |
@@ -16,10 +16,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._2 = exports._1 = void 0; | ||
exports._2 = void 0; | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./ts"), exports); | ||
__exportStar(require("./path"), exports); | ||
__exportStar(require("./uriMap"), exports); | ||
// fix build | ||
exports._1 = require("vscode-languageserver-textdocument"); | ||
exports._2 = require("vscode-uri"); | ||
//# sourceMappingURL=index.js.map |
import { URI } from 'vscode-uri'; | ||
import type { DocumentUri } from 'vscode-languageserver-textdocument'; | ||
import * as path from 'typesafe-path'; | ||
export declare function getPathOfUri(uri: DocumentUri): path.PosixPath; | ||
export declare function getPathOfUri(uri: string): path.PosixPath; | ||
export declare function normalizeFileName(fsPath: string): path.PosixPath; | ||
@@ -6,0 +5,0 @@ export declare function normalizeUri(uri: string): string; |
{ | ||
"name": "@volar/shared", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"main": "out/index.js", | ||
@@ -17,7 +17,5 @@ "license": "MIT", | ||
"typesafe-path": "^0.2.2", | ||
"vscode-languageserver-protocol": "^3.17.2", | ||
"vscode-languageserver-textdocument": "^1.0.7", | ||
"vscode-uri": "^3.0.6" | ||
}, | ||
"gitHead": "be2081f56ce4608324795b8a0ae83c288a3a784d" | ||
"gitHead": "89b82f92fdc30674b03941c5f17c60df8c46211c" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
2
5697
8
100
1
- Removedvscode-jsonrpc@8.2.0(transitive)
- Removedvscode-languageserver-protocol@3.17.5(transitive)
- Removedvscode-languageserver-textdocument@1.0.12(transitive)
- Removedvscode-languageserver-types@3.17.5(transitive)