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

@stylable/language-service

Package Overview
Dependencies
Maintainers
6
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 5.4.1-rc.1 to 5.5.0

22

dist/lib/completion-providers.js

@@ -848,14 +848,20 @@ "use strict";

const resolvedStates = collectStates(lastNode);
if (Object.keys(resolvedStates).length) {
const resolvedStateNode = lastNode.resolved.find((node) => {
const states = node.symbol[`-st-states`];
return states && states[stateName] && states[stateName].type === 'enum';
const resolvedState = resolvedStates[stateName];
if (resolvedState &&
typeof resolvedState !== 'string' &&
(resolvedState.type === 'enum' ||
(index_internal_1.STCustomState.isTemplateState(resolvedState) &&
resolvedState.params[0].type === 'enum'))) {
const resolvedStateNode = lastNode.resolved.find(({ symbol }) => {
const states = symbol['-st-states'];
return (states === null || states === void 0 ? void 0 : states[stateName]) === resolvedState;
});
if (resolvedStateNode) {
const resolvedState = resolvedStateNode.symbol[`-st-states`][stateName];
const enumStateParam = index_internal_1.STCustomState.isTemplateState(resolvedState)
? resolvedState.params[0]
: resolvedState;
let existingInput = fullLineText.slice(0, position.character);
existingInput = existingInput.slice(existingInput.lastIndexOf('(') + 1);
if (typeof resolvedState !== 'string' &&
(resolvedState === null || resolvedState === void 0 ? void 0 : resolvedState.arguments.every((opt) => typeof opt === 'string'))) {
const options = resolvedState.arguments;
if (enumStateParam === null || enumStateParam === void 0 ? void 0 : enumStateParam.arguments.every((opt) => typeof opt === 'string')) {
const options = enumStateParam.arguments;
let filteredOptions = options.filter((opt) => opt.startsWith(existingInput));

@@ -862,0 +868,0 @@ filteredOptions = filteredOptions.length ? filteredOptions : options;

import type { SignatureHelp } from 'vscode-languageserver';
import { StateParsedValue } from '@stylable/core/dist/index-internal';
import { StateParsedValue, TemplateStateParsedValue } from '@stylable/core/dist/index-internal';
import type { ProviderPosition } from '../completion-providers';

@@ -10,3 +10,3 @@ export declare function resolveStateTypeOrValidator(pos: ProviderPosition, line: string): string | boolean | null;

}): boolean;
export declare function resolveStateParams(stateDef: StateParsedValue): string;
export declare function resolveStateParams(stateDef: StateParsedValue | TemplateStateParsedValue): string;
//# sourceMappingURL=pseudo-class.d.ts.map

@@ -139,3 +139,6 @@ "use strict";

const typeArguments = [];
if (stateDef.arguments.length > 0) {
if (index_internal_1.STCustomState.isTemplateState(stateDef)) {
return resolveStateParams(stateDef.params[0]);
}
else if (stateDef.arguments.length > 0) {
stateDef.arguments.forEach((arg) => {

@@ -142,0 +145,0 @@ if (typeof arg === 'object') {

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

@@ -14,13 +14,13 @@ "main": "dist/index.js",

"dependencies": {
"@file-services/types": "^7.0.1",
"@file-services/typescript": "^7.0.1",
"@stylable/code-formatter": "5.4.1-rc.1",
"@stylable/core": "5.4.1-rc.1",
"@file-services/types": "^7.2.0",
"@file-services/typescript": "^7.2.0",
"@stylable/code-formatter": "^5.5.0",
"@stylable/core": "^5.5.0",
"css-selector-tokenizer": "^0.8.0",
"postcss": "^8.4.19",
"postcss": "^8.4.20",
"postcss-value-parser": "^4.2.0",
"vscode-css-languageservice": "^6.2.1",
"vscode-languageserver": "^8.0.2",
"vscode-languageserver-textdocument": "^1.0.7",
"vscode-uri": "^3.0.6"
"vscode-languageserver-textdocument": "^1.0.8",
"vscode-uri": "^3.0.7"
},

@@ -27,0 +27,0 @@ "author": "Wix.com",

@@ -1408,18 +1408,23 @@ import path, { dirname } from 'path';

const resolvedStates: MappedStates = collectStates(lastNode);
if (Object.keys(resolvedStates).length) {
const resolvedStateNode = lastNode.resolved.find((node: any) => {
const states = node.symbol[`-st-states`];
return states && states[stateName] && states[stateName].type === 'enum';
const resolvedState = resolvedStates[stateName];
if (
resolvedState &&
typeof resolvedState !== 'string' &&
(resolvedState.type === 'enum' ||
(STCustomState.isTemplateState(resolvedState) &&
resolvedState.params[0].type === 'enum'))
) {
const resolvedStateNode = lastNode.resolved.find(({ symbol }: any) => {
const states = symbol['-st-states'];
return states?.[stateName] === resolvedState;
});
if (resolvedStateNode) {
const resolvedState = resolvedStateNode.symbol[`-st-states`]![stateName];
const enumStateParam = STCustomState.isTemplateState(resolvedState)
? resolvedState.params[0]
: resolvedState;
let existingInput = fullLineText.slice(0, position.character);
existingInput = existingInput.slice(existingInput.lastIndexOf('(') + 1);
if (
typeof resolvedState !== 'string' &&
resolvedState?.arguments.every((opt) => typeof opt === 'string')
) {
const options = resolvedState.arguments as string[];
if (enumStateParam?.arguments.every((opt) => typeof opt === 'string')) {
const options = enumStateParam.arguments as string[];
let filteredOptions = options.filter((opt: string) =>

@@ -1426,0 +1431,0 @@ opt.startsWith(existingInput)

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

} from 'vscode-languageserver';
import { StateParsedValue, STCustomState } from '@stylable/core/dist/index-internal';
import {
StateParsedValue,
STCustomState,
TemplateStateParsedValue,
} from '@stylable/core/dist/index-internal';
import type { ProviderPosition } from '../completion-providers';

@@ -205,5 +209,7 @@

export function resolveStateParams(stateDef: StateParsedValue) {
export function resolveStateParams(stateDef: StateParsedValue | TemplateStateParsedValue): string {
const typeArguments: string[] = [];
if (stateDef.arguments.length > 0) {
if (STCustomState.isTemplateState(stateDef)) {
return resolveStateParams(stateDef.params[0]);
} else if (stateDef.arguments.length > 0) {
stateDef.arguments.forEach((arg) => {

@@ -210,0 +216,0 @@ if (typeof arg === 'object') {

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