Binary version published on npm of vscode-css-languageserver extracted from VSCode tree
Switch branches/tags
Nothing to show
Clone or download

README.md

vscode-css-languageserver-bin

npm Join the chat at https://gitter.im/vscode-langservers/Lobby

Binary version published on npm of vscode-css-languageserver extracted from VSCode tree

Features

  • CSS Support
  • LESS Support
  • SASS Support
  • Completion provider (Need Snippets Support)
  • Color provider
  • Code Actions (rename mispelled properties)
  • Validation (syntax and lint errros)
  • Hover tooltip provider
  • Definition provider
  • Hover provider
  • References provider
  • Document Symbols & Highlights
  • Rename symbol
  • Scoped Settings

Clients

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

To install this Language Server you need npm on your machine

Installing

npm install --global vscode-css-languageserver-bin

Launching the Server

The common way to launch it is by using stdio transport:

css-languageserver --stdio

The server can also be launched with one of the following transports:

css-languageserver --socket={number}
css-languageserver --node-ipc

Settings

This Language Server accepts some settings sent with workspace/didChangeConfiguration

type Level = "ignore" | "error" | "warning"

type LintSettings = {
	// From: https://github.com/Microsoft/vscode-css-languageservice/blob/master/src/services/lintRules.ts#L25

	compatibleVendorPrefixes?: Level, // When using a vendor-specific prefix make sure to also include all other vendor-specific properties. Default: Ignore
	vendorPrefix?: Level, // When using a vendor-specific prefix also include the standard property. Default: Warning
	duplicateProperties?: Level, //, localize('rule.duplicateDeclarations', "Do not use duplicate style definitions. Default: Ignore
	emptyRules?: Level, // Do not use empty rulesets. Default: Warning
	importStatement?: Level, // Import statements do not load in parallel. Default: Ignore
	boxModel?: Level, // Do not use width or height when using padding or border. Default: Ignore
	universalSelector?: Level, // The universal selector (*) is known to be slow. Default: Ignore
	zeroUnits?: Level, // No unit for zero needed. Default: Ignore
	fontFaceProperties?: Level, // @font-face rule must define 'src' and 'font-family' properties. Default: Warning
	hexColorLength?: Level, // Hex colors must consist of three, four, six or eight hex numbers. Default: Error
	argumentsInColorFunction?: Level, // Invalid number of parameters. Default: Error
	unknownProperties?: Level, // Unknown property. Default: Warning
	ieHack?: Level, // IE hacks are only necessary when supporting IE7 and older. Default: Ignore
	unknownVendorSpecificProperties?: Level // Unknown vendor specific property. Default: Ignore
	propertyIgnoredDueToDisplay?: Level, // Property is ignored due to the display. Default: Warning
	important?: Level, // Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored. Default: Ignore
	float?: Level, // Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes. Default: Ignore
	idSelector?: Level // Selectors should not contain IDs because these rules are too tightly coupled with the HTML. Default: Ignore
};

interface LanguageSettings {
	validate?: boolean;
	lint?: LintSettings;
}

interface Settings {
	css?: LanguageSettings,
	scss?: LanguageSettings,
	less?: LanguageSettings
}

Deployment

npm run publish
# or to try locally
npm run pack

Contributing

PRs are welcome. To setup the repo locally run:

git clone --recursive https://github.com/vscode-langservers/vscode-css-languageserver-bin
cd vscode-css-languageserver-bin
npm install
npm run pack

Versioning

We use SemVer for versioning.

Because we can't guess VSCode extention version, we update MINOR when submodule is updated and PATCH when only build method is updated

License

This project is licensed under the MIT License - see the LICENSE file for details

This is a derived work please see VSCode's LICENSE.txt for the original copyright and license.