New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stylable-intelligence

Package Overview
Dependencies
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylable-intelligence - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

6

dist/src/lib/server.js

@@ -20,4 +20,4 @@ "use strict";

docs.listen(connection);
docs.onDidChangeContent(vscodeStylableLSP.createDiagnosticsHandler());
docs.onDidClose(vscodeStylableLSP.onDidClose());
docs.onDidChangeContent(vscodeStylableLSP.diagnoseWithVsCodeConfig.bind(vscodeStylableLSP));
docs.onDidClose(vscodeStylableLSP.onDidClose.bind(vscodeStylableLSP));
connection.onCompletion(vscodeStylableLSP.onCompletion.bind(vscodeStylableLSP));

@@ -32,3 +32,3 @@ connection.onDefinition(vscodeStylableLSP.onDefinition.bind(vscodeStylableLSP));

// eslint-disable-next-line @typescript-eslint/no-misused-promises
connection.onDidChangeConfiguration(vscodeStylableLSP.createDiagnosticsHandler());
connection.onDidChangeConfiguration(vscodeStylableLSP.diagnoseWithVsCodeConfig.bind(vscodeStylableLSP));
// connection.onDocumentFormatting(stylableLSP.onDocumentFormatting.bind(stylableLSP));

@@ -35,0 +35,0 @@ return capabilities_1.initializeResult;

import { IFileSystem } from '@file-services/types';
import { Stylable } from '@stylable/core';
import { StylableLanguageService } from '@stylable/language-service';
import { ColorInformation, ColorPresentation, ColorPresentationParams, CompletionParams, CompletionItem, Definition, DocumentColorParams, Hover, IConnection, Location, TextDocumentChangeEvent, TextDocumentPositionParams, TextDocuments, ReferenceParams, RenameParams, SignatureHelp, WorkspaceEdit, TextDocument } from 'vscode-languageserver';
import { ColorInformation, ColorPresentation, ColorPresentationParams, CompletionParams, CompletionItem, Definition, Diagnostic, DocumentColorParams, Hover, IConnection, Location, TextDocumentChangeEvent, TextDocumentPositionParams, TextDocuments, ReferenceParams, RenameParams, SignatureHelp, WorkspaceEdit, TextDocument } from 'vscode-languageserver';
export declare class VscodeStylableLanguageService {
textDocuments: TextDocuments<TextDocument>;
protected languageService: StylableLanguageService;
languageService: StylableLanguageService;
private connection;

@@ -18,6 +18,6 @@ constructor(connection: IConnection, docs: TextDocuments<TextDocument>, fs: IFileSystem, stylable: Stylable);

onColorPresentation(params: ColorPresentationParams): ColorPresentation[];
createDiagnosticsHandler(): () => Promise<import("vscode-languageserver-types").Diagnostic[]>;
onDidClose(): (event: TextDocumentChangeEvent<TextDocument>) => void;
diagnoseWithVsCodeConfig(): Promise<Diagnostic[]>;
onDidClose(event: TextDocumentChangeEvent<TextDocument>): void;
private getDocAndPath;
}
//# sourceMappingURL=vscode-service.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const language_service_1 = require("@stylable/language-service");
const path_1 = __importDefault(require("path"));
const vscode_uri_1 = require("vscode-uri");
const diagnose_1 = require("./diagnose");
class VscodeStylableLanguageService {

@@ -49,19 +52,54 @@ constructor(connection, docs, fs, stylable) {

}
createDiagnosticsHandler() {
const diagnoseConfig = {
connection: this.connection,
cssService: this.languageService.cssService,
docsDispatcher: this.textDocuments,
stylable: this.languageService.getStylable()
};
return () => diagnose_1.diagnose(diagnoseConfig);
}
onDidClose() {
return (event) => {
this.connection.sendDiagnostics({
diagnostics: [],
uri: event.document.uri
async diagnoseWithVsCodeConfig() {
let res;
let ignore = false;
try {
res = await this.connection.workspace.getConfiguration({
section: 'stylable'
});
};
if (!!res && !!res.diagnostics && !!res.diagnostics.ignore && !!res.diagnostics.ignore.length) {
ignore = true;
}
}
catch (e) {
/*Client has no workspace/configuration method, ignore silently */
}
const result = [];
this.textDocuments.keys().forEach(key => {
const doc = this.textDocuments.get(key);
if (doc) {
if (doc.languageId === 'stylable') {
const uri = vscode_uri_1.URI.parse(doc.uri);
// on windows, uri.fsPath replaces separators with '\'
// this breaks posix paths in-memory when running on windows
// take raw posix path instead
const fsPath = uri.scheme === 'file' &&
!uri.authority && // not UNC
uri.path.charCodeAt(2) !== 58 && // the colon in "c:"
path_1.default.isAbsolute(uri.path)
? uri.path
: uri.fsPath;
let diagnostics;
if (ignore &&
res.diagnostics.ignore.some(p => {
return fsPath.startsWith(p);
})) {
diagnostics = [];
}
else {
diagnostics = this.languageService.diagnose(fsPath);
result.push(...diagnostics);
}
this.connection.sendDiagnostics({ uri: doc.uri, diagnostics });
}
}
});
return result;
}
onDidClose(event) {
return this.connection.sendDiagnostics({
diagnostics: [],
uri: event.document.uri
});
}
getDocAndPath(uri) {

@@ -68,0 +106,0 @@ const { fsPath } = vscode_uri_1.URI.parse(uri);

@@ -6,3 +6,3 @@ {

"license": "BSD-3-Clause",
"version": "0.4.2",
"version": "0.5.0",
"description": "Stylable Language Services - syntax highlighting, completions, hinting and more for the Stylable CSS preprocessor.",

@@ -27,4 +27,4 @@ "icon": "images/icon.png",

"@file-services/node": "^2.1.1",
"@stylable/core": "^3.1.3",
"@stylable/language-service": "^3.1.3",
"@stylable/core": "^3.1.4",
"@stylable/language-service": "^3.1.4",
"vscode-languageclient": "^6.1.0",

@@ -31,0 +31,0 @@ "vscode-languageserver": "^6.1.0",

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

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