Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stylable/language-service

Package Overview
Dependencies
Maintainers
5
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/language-service - npm Package Compare versions

Comparing version 3.3.2-rc.1 to 3.4.0

9

cjs/lib/css-service.d.ts
import { IFileSystem } from '@file-services/types';
import postcss from 'postcss';
import * as VCL from 'vscode-css-languageservice';
import { ColorInformation, TextDocument } from 'vscode-languageserver-protocol';
import { CompletionItem, Diagnostic, Hover, Location, Position, Range } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { Color, ColorInformation, ColorPresentation, CompletionItem, Diagnostic, Hover, Location, Position, Range } from 'vscode-languageserver-types';
/**

@@ -20,6 +19,6 @@ * the API for "normal" css language features fallback

findReferences(document: TextDocument, position: Position): Location[];
getColorPresentations(document: TextDocument, color: VCL.Color, range: Range): VCL.ColorPresentation[];
getColorPresentations(document: TextDocument, color: Color, range: Range): ColorPresentation[];
findColors(document: TextDocument): ColorInformation[];
findColor(document: TextDocument): VCL.Color | null;
findColor(document: TextDocument): Color | null;
}
//# sourceMappingURL=css-service.d.ts.map

@@ -5,13 +5,6 @@ "use strict";

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const VCL = __importStar(require("vscode-css-languageservice"));
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
const vscode_css_languageservice_1 = require("vscode-css-languageservice");
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
const vscode_languageserver_types_1 = require("vscode-languageserver-types");

@@ -51,3 +44,3 @@ const vscode_uri_1 = require("vscode-uri");

this.fs = fs;
this.inner = VCL.getCSSLanguageService();
this.inner = vscode_css_languageservice_1.getCSSLanguageService({ fileSystemProvider: this.fs.promises }); // TODO: FIX TYPE
}

@@ -61,3 +54,3 @@ getCompletions(document, position) {

cleanContentAst = this.cleanStScopes(cleanContentAst);
return vscode_languageserver_protocol_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', version, cleanContentAst.toString());
return vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', version, cleanContentAst.toString());
}

@@ -64,0 +57,0 @@ // cleaning strategy: replace the "value(*)" syntax with spaces,

import { IFileSystem } from '@file-services/types';
import { Stylable } from '@stylable/core';
import { ColorInformation, ColorPresentation } from 'vscode-css-languageservice';
import { ColorPresentationParams, TextDocument } from 'vscode-languageserver-protocol';
import { ColorPresentationParams } from 'vscode-languageserver-protocol';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { CssService } from '../css-service';

@@ -6,0 +7,0 @@ export declare function resolveDocumentColors(stylable: Stylable, cssService: CssService, document: TextDocument, fs: IFileSystem): ColorInformation[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@stylable/core");
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
const vscode_uri_1 = require("vscode-uri");

@@ -25,3 +25,3 @@ const completion_providers_1 = require("../completion-providers");

if (sym && sym._kind === 'var') {
const doc = vscode_languageserver_protocol_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
const doc = vscode_languageserver_textdocument_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
core_1.evalDeclarationValue(stylable.resolver, sym.text, meta, sym.node) +

@@ -35,3 +35,3 @@ '}');

if (relevantVar) {
const doc = vscode_languageserver_protocol_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
const doc = vscode_languageserver_textdocument_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
core_1.evalDeclarationValue(stylable.resolver, 'value(' + sym.name + ')', impMeta, relevantVar.node) +

@@ -66,3 +66,3 @@ '}');

vars.forEach(v => {
const doc = vscode_languageserver_protocol_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
const doc = vscode_languageserver_textdocument_1.TextDocument.create('', 'css', 0, '.gaga {border: ' +
core_1.evalDeclarationValue(stylable.resolver, v.text, impMeta, v.node) +

@@ -69,0 +69,0 @@ '}');

import { IFileSystem } from '@file-services/types';
import { Stylable } from '@stylable/core';
import { ColorPresentationParams } from 'vscode-languageserver-protocol';
import { Color, ColorInformation, ColorPresentation, CompletionItem, Definition, Diagnostic, Hover, Location, ParameterInformation, Position, SignatureHelp, TextDocument, WorkspaceEdit } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { Color, ColorInformation, ColorPresentation, CompletionItem, Diagnostic, Hover, Location, ParameterInformation, Position, SignatureHelp, WorkspaceEdit } from 'vscode-languageserver-types';
import { ProviderPosition } from './completion-providers';

@@ -24,3 +25,3 @@ import { Completion } from './completion-types';

onCompletion(filePath: string, offset: number): CompletionItem[];
onDefinition(filePath: string, offset: number): Definition;
onDefinition(filePath: string, offset: number): Location[];
onHover(filePath: string, offset: number): Hover | null;

@@ -27,0 +28,0 @@ onReferences(filePath: string, offset: number): Location[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@stylable/core");
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
const vscode_languageserver_types_1 = require("vscode-languageserver-types");

@@ -31,3 +32,3 @@ const vscode_uri_1 = require("vscode-uri");

if (stylableFile && stylableFile.stat.isFile()) {
const document = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const document = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const position = document.positionAt(offset);

@@ -43,3 +44,3 @@ return this.getCompletions(document, filePath, position);

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const res = this.provider.getDefinitionLocation(stylableFile.content, doc.positionAt(offset), filePath, this.fs);

@@ -53,3 +54,3 @@ return res.map(loc => vscode_languageserver_types_1.Location.create(vscode_uri_1.URI.file(loc.uri).toString(), loc.range));

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
return this.cssService.doHover(doc, doc.positionAt(offset));

@@ -62,3 +63,3 @@ }

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const position = doc.positionAt(offset);

@@ -78,3 +79,3 @@ const refs = this.getRefs(filePath, position);

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
return color_provider_1.resolveDocumentColors(this.stylable, this.cssService, doc, this.fs);

@@ -87,3 +88,3 @@ }

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const range = vscode_languageserver_types_1.Range.create(doc.positionAt(offset.start), doc.positionAt(offset.end));

@@ -98,3 +99,3 @@ return color_provider_1.getColorPresentation(this.cssService, doc, { color, range, textDocument: doc });

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
provider_2.getRenameRefs(filePath, doc.positionAt(offset), this.fs, this.stylable).forEach(ref => {

@@ -114,3 +115,3 @@ if (edit.changes[ref.uri]) {

if (stylableFile && stylableFile.stat.isFile()) {
const doc = vscode_languageserver_types_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const doc = vscode_languageserver_textdocument_1.TextDocument.create(vscode_uri_1.URI.file(filePath).toString(), 'stylable', stylableFile.stat.mtime.getTime(), stylableFile.content);
const sig = this.provider.getSignatureHelp(stylableFile.content, doc.positionAt(offset), filePath, this.fs, vscode_languageserver_types_1.ParameterInformation);

@@ -117,0 +118,0 @@ return sig;

{
"name": "@stylable/language-service",
"version": "3.3.2-rc.1",
"version": "3.4.0",
"description": "Stylable Language Services - syntax highlighting, completions, hinting and more for the Stylable CSS preprocessor.",

@@ -18,5 +18,5 @@ "main": "./cjs/index.js",

"dependencies": {
"@file-services/node": "^2.1.1",
"@file-services/typescript": "^2.1.2",
"@stylable/core": "^3.3.2-rc.1",
"@file-services/node": "^2.2.0",
"@file-services/typescript": "^2.2.0",
"@stylable/core": "^3.4.0",
"css-selector-tokenizer": "^0.7.2",

@@ -27,2 +27,3 @@ "postcss": "^7.0.27",

"vscode-languageserver": "^6.1.1",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-uri": "^2.1.1"

@@ -44,3 +45,3 @@ },

"license": "BSD-3-Clause",
"gitHead": "1262e65a7151abeb401911cd9a5d25cff13eb536"
"gitHead": "af5fcd5514c9364e8fdd6fda29585ae4ea1b27e1"
}

@@ -0,0 +0,0 @@ import path from 'path';

import { IFileSystem } from '@file-services/types';
import path from 'path';
import postcss from 'postcss';
import * as VCL from 'vscode-css-languageservice';
import { ColorInformation, TextDocument } from 'vscode-languageserver-protocol';
import { getCSSLanguageService, Stylesheet } from 'vscode-css-languageservice';
import { TextDocument } from 'vscode-languageserver-textdocument';
import {
Color,
ColorInformation,
ColorPresentation,
CompletionItem,

@@ -50,3 +53,3 @@ Diagnostic,

export class CssService {
private inner = VCL.getCSSLanguageService();
private inner = getCSSLanguageService({ fileSystemProvider: this.fs.promises as any }); // TODO: FIX TYPE

@@ -208,6 +211,6 @@ constructor(private fs: IFileSystem) {}

document: TextDocument,
color: VCL.Color,
color: Color,
range: Range
): VCL.ColorPresentation[] {
const stylesheet: VCL.Stylesheet = this.inner.parseStylesheet(document);
): ColorPresentation[] {
const stylesheet: Stylesheet = this.inner.parseStylesheet(document);
return this.inner.getColorPresentations(document, stylesheet, color, range);

@@ -217,7 +220,7 @@ }

public findColors(document: TextDocument): ColorInformation[] {
const stylesheet: VCL.Stylesheet = this.inner.parseStylesheet(document);
const stylesheet: Stylesheet = this.inner.parseStylesheet(document);
return this.inner.findDocumentColors(document, stylesheet);
}
public findColor(document: TextDocument): VCL.Color | null {
public findColor(document: TextDocument): Color | null {
const colors = this.findColors(document);

@@ -224,0 +227,0 @@ return colors.length ? colors[0].color : null;

@@ -0,0 +0,0 @@ import { Diagnostic as StylableDiagnostic, process, safeParse, Stylable } from '@stylable/core';

import { IFileSystem } from '@file-services/types';
import { evalDeclarationValue, Stylable, StylableMeta, valueMapping } from '@stylable/core';
import { Color, ColorInformation, ColorPresentation } from 'vscode-css-languageservice';
import { ColorPresentationParams, TextDocument } from 'vscode-languageserver-protocol';
import { ColorPresentationParams } from 'vscode-languageserver-protocol';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { URI } from 'vscode-uri';

@@ -6,0 +7,0 @@ import { ProviderPosition, ProviderRange } from '../completion-providers';

@@ -0,0 +0,0 @@ import postcssValueParser from 'postcss-value-parser';

import { IFileSystem, IFileSystemStats } from '@file-services/types';
import { Stylable, safeParse } from '@stylable/core';
import { ColorPresentationParams } from 'vscode-languageserver-protocol';
import { TextDocument } from 'vscode-languageserver-textdocument';
import {

@@ -10,3 +11,2 @@ Color,

CompletionItem,
Definition,
Diagnostic,

@@ -19,3 +19,2 @@ Hover,

SignatureHelp,
TextDocument,
TextEdit,

@@ -84,3 +83,3 @@ WorkspaceEdit

public onDefinition(filePath: string, offset: number): Definition {
public onDefinition(filePath: string, offset: number): Location[] {
const stylableFile = this.readStylableFile(filePath);

@@ -87,0 +86,0 @@

@@ -0,0 +0,0 @@ import ts from 'typescript';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc