vscode-css-languageservice
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -57,5 +57,4 @@ /*--------------------------------------------------------------------------------------------- | ||
import * as nodes from '../parser/cssNodes'; | ||
import { URI } from 'vscode-uri'; | ||
import { URI, Utils } from 'vscode-uri'; | ||
import { startsWith } from '../utils/strings'; | ||
import { extname } from '../utils/resources'; | ||
var SCSSNavigation = /** @class */ (function (_super) { | ||
@@ -123,7 +122,8 @@ __extends(SCSSNavigation, _super); | ||
target = _a.sent(); | ||
if (!(this.fileSystemProvider && target && extname(target).length === 0)) return [3 /*break*/, 8]; | ||
if (!(this.fileSystemProvider && target)) return [3 /*break*/, 8]; | ||
parsedUri = URI.parse(target); | ||
if (!(parsedUri.path && Utils.extname(parsedUri).length === 0)) return [3 /*break*/, 8]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 7, , 8]); | ||
parsedUri = URI.parse(target); | ||
pathVariations = toPathVariations(parsedUri); | ||
@@ -130,0 +130,0 @@ if (!pathVariations) return [3 /*break*/, 6]; |
@@ -436,3 +436,2 @@ /*--------------------------------------------------------------------------------------------- | ||
if (this.prev && this.prev.matches('~')) { | ||
this.element.addChild(toElement(selectorChild)); | ||
this.element.addChild(new LabelElement('\u22EE')); | ||
@@ -439,0 +438,0 @@ } |
@@ -5,64 +5,13 @@ /*--------------------------------------------------------------------------------------------- | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { URI } from "vscode-uri"; | ||
var Slash = '/'.charCodeAt(0); | ||
var Dot = '.'.charCodeAt(0); | ||
export function isAbsolutePath(path) { | ||
return path.charCodeAt(0) === Slash; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
import { URI, Utils } from 'vscode-uri'; | ||
export function dirname(uriString) { | ||
return Utils.dirname(URI.parse(uriString)).toString(); | ||
} | ||
export function dirname(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return lastIndexOfSlash !== -1 ? uri.substr(0, lastIndexOfSlash) : ''; | ||
} | ||
export function basename(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return uri.substr(lastIndexOfSlash + 1); | ||
} | ||
export function extname(uri) { | ||
for (var i = uri.length - 1; i >= 0; i--) { | ||
var ch = uri.charCodeAt(i); | ||
if (ch === Dot) { | ||
if (i > 0 && uri.charCodeAt(i - 1) !== Slash) { | ||
return uri.substr(i); | ||
} | ||
else { | ||
break; | ||
} | ||
} | ||
else if (ch === Slash) { | ||
break; | ||
} | ||
} | ||
return ''; | ||
} | ||
export function resolvePath(uriString, path) { | ||
if (isAbsolutePath(path)) { | ||
var uri = URI.parse(uriString); | ||
var parts = path.split('/'); | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
} | ||
return joinPath(uriString, path); | ||
} | ||
export function normalizePath(parts) { | ||
var newParts = []; | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) { | ||
// ignore | ||
} | ||
else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) { | ||
newParts.pop(); | ||
} | ||
else { | ||
newParts.push(part); | ||
} | ||
} | ||
if (parts.length > 1 && parts[parts.length - 1].length === 0) { | ||
newParts.push(''); | ||
} | ||
var res = newParts.join('/'); | ||
if (parts[0].length === 0) { | ||
res = '/' + res; | ||
} | ||
return res; | ||
} | ||
export function joinPath(uriString) { | ||
@@ -73,9 +22,3 @@ var paths = []; | ||
} | ||
var uri = URI.parse(uriString); | ||
var parts = uri.path.split('/'); | ||
for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) { | ||
var path = paths_1[_a]; | ||
parts.push.apply(parts, path.split('/')); | ||
} | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
return Utils.joinPath.apply(Utils, __spreadArrays([URI.parse(uriString)], paths)).toString(); | ||
} |
@@ -56,3 +56,3 @@ var __extends = (this && this.__extends) || (function () { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./cssNavigation", "../parser/cssNodes", "vscode-uri", "../utils/strings", "../utils/resources"], factory); | ||
define(["require", "exports", "./cssNavigation", "../parser/cssNodes", "vscode-uri", "../utils/strings"], factory); | ||
} | ||
@@ -71,3 +71,2 @@ })(function (require, exports) { | ||
var strings_1 = require("../utils/strings"); | ||
var resources_1 = require("../utils/resources"); | ||
var SCSSNavigation = /** @class */ (function (_super) { | ||
@@ -135,7 +134,8 @@ __extends(SCSSNavigation, _super); | ||
target = _a.sent(); | ||
if (!(this.fileSystemProvider && target && resources_1.extname(target).length === 0)) return [3 /*break*/, 8]; | ||
if (!(this.fileSystemProvider && target)) return [3 /*break*/, 8]; | ||
parsedUri = vscode_uri_1.URI.parse(target); | ||
if (!(parsedUri.path && vscode_uri_1.Utils.extname(parsedUri).length === 0)) return [3 /*break*/, 8]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 7, , 8]); | ||
parsedUri = vscode_uri_1.URI.parse(target); | ||
pathVariations = toPathVariations(parsedUri); | ||
@@ -142,0 +142,0 @@ if (!pathVariations) return [3 /*break*/, 6]; |
@@ -448,3 +448,2 @@ var __extends = (this && this.__extends) || (function () { | ||
if (this.prev && this.prev.matches('~')) { | ||
this.element.addChild(toElement(selectorChild)); | ||
this.element.addChild(new LabelElement('\u22EE')); | ||
@@ -451,0 +450,0 @@ } |
@@ -5,2 +5,9 @@ /*--------------------------------------------------------------------------------------------- | ||
*--------------------------------------------------------------------------------------------*/ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
(function (factory) { | ||
@@ -17,71 +24,8 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.joinPath = exports.normalizePath = exports.resolvePath = exports.extname = exports.basename = exports.dirname = exports.isAbsolutePath = void 0; | ||
exports.joinPath = exports.dirname = void 0; | ||
var vscode_uri_1 = require("vscode-uri"); | ||
var Slash = '/'.charCodeAt(0); | ||
var Dot = '.'.charCodeAt(0); | ||
function isAbsolutePath(path) { | ||
return path.charCodeAt(0) === Slash; | ||
function dirname(uriString) { | ||
return vscode_uri_1.Utils.dirname(vscode_uri_1.URI.parse(uriString)).toString(); | ||
} | ||
exports.isAbsolutePath = isAbsolutePath; | ||
function dirname(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return lastIndexOfSlash !== -1 ? uri.substr(0, lastIndexOfSlash) : ''; | ||
} | ||
exports.dirname = dirname; | ||
function basename(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return uri.substr(lastIndexOfSlash + 1); | ||
} | ||
exports.basename = basename; | ||
function extname(uri) { | ||
for (var i = uri.length - 1; i >= 0; i--) { | ||
var ch = uri.charCodeAt(i); | ||
if (ch === Dot) { | ||
if (i > 0 && uri.charCodeAt(i - 1) !== Slash) { | ||
return uri.substr(i); | ||
} | ||
else { | ||
break; | ||
} | ||
} | ||
else if (ch === Slash) { | ||
break; | ||
} | ||
} | ||
return ''; | ||
} | ||
exports.extname = extname; | ||
function resolvePath(uriString, path) { | ||
if (isAbsolutePath(path)) { | ||
var uri = vscode_uri_1.URI.parse(uriString); | ||
var parts = path.split('/'); | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
} | ||
return joinPath(uriString, path); | ||
} | ||
exports.resolvePath = resolvePath; | ||
function normalizePath(parts) { | ||
var newParts = []; | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) { | ||
// ignore | ||
} | ||
else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) { | ||
newParts.pop(); | ||
} | ||
else { | ||
newParts.push(part); | ||
} | ||
} | ||
if (parts.length > 1 && parts[parts.length - 1].length === 0) { | ||
newParts.push(''); | ||
} | ||
var res = newParts.join('/'); | ||
if (parts[0].length === 0) { | ||
res = '/' + res; | ||
} | ||
return res; | ||
} | ||
exports.normalizePath = normalizePath; | ||
function joinPath(uriString) { | ||
@@ -92,11 +36,5 @@ var paths = []; | ||
} | ||
var uri = vscode_uri_1.URI.parse(uriString); | ||
var parts = uri.path.split('/'); | ||
for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) { | ||
var path = paths_1[_a]; | ||
parts.push.apply(parts, path.split('/')); | ||
} | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
return vscode_uri_1.Utils.joinPath.apply(vscode_uri_1.Utils, __spreadArrays([vscode_uri_1.URI.parse(uriString)], paths)).toString(); | ||
} | ||
exports.joinPath = joinPath; | ||
}); |
{ | ||
"name": "vscode-css-languageservice", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Language service for CSS, LESS and SCSS", | ||
@@ -32,3 +32,3 @@ "main": "./lib/umd/cssLanguageService.js", | ||
"vscode-nls": "^5.0.0", | ||
"vscode-uri": "^2.1.2" | ||
"vscode-uri": "^3.0.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "scripts": { |
2886936
67980
+ Addedvscode-uri@3.0.8(transitive)
- Removedvscode-uri@2.1.2(transitive)
Updatedvscode-uri@^3.0.0