Giter Site home page Giter Site logo

gaybro8777 / vscode-css-languageservice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/vscode-css-languageservice

0.0 1.0 0.0 1.43 MB

CSS, LESS & SCSS language service extracted from VSCode to be reused, e.g in the Monaco editor.

License: MIT License

JavaScript 2.45% TypeScript 97.01% CSS 0.54%

vscode-css-languageservice's Introduction

vscode-css-languageservice

Language services for CSS, LESS and SCSS

npm Package NPM Downloads Build Status

Why?

The vscode-css-languageservice contains the language smarts behind the CSS, LESS and SCSS editing experience of Visual Studio Code and the Monaco editor.

  • doValidation analyses an input string and returns syntax and lint errros.
  • doComplete provides completion proposals for a given location.
  • doHover provides a hover text for a given location.
  • findDefinition finds the definition of the symbol at the given location.
  • findReferences finds all references to the symbol at the given location.
  • findDocumentHighlights finds all symbols connected to the given location.
  • findDocumentSymbols provides all symbols in the given document
  • doCodeActions evaluats code actions for the given location, typically to fix a problem.
  • findColorSymbols evaluates all color symbols in the given document
  • doRename renames all symbols connected to the given location.
  • getFoldingRanges returns folding ranges in the given document.

Installation

npm install --save vscode-css-languageservice

API

export interface LanguageService {
	configure(raw: LanguageSettings): void;
	doValidation(document: TextDocument, stylesheet: Stylesheet, documentSettings?: LanguageSettings): Diagnostic[];
	parseStylesheet(document: TextDocument): Stylesheet;
	doComplete(document: TextDocument, position: Position, stylesheet: Stylesheet): CompletionList;
	setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void;
	doHover(document: TextDocument, position: Position, stylesheet: Stylesheet): Hover | null;
	findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null;
	findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[];
	findDocumentHighlights(document: TextDocument, position: Position, stylesheet: Stylesheet): DocumentHighlight[];
	findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
	doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
	doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
	findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
	getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
	doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
	getFoldingRanges(document: TextDocument, context?: { rangeLimit?: number; }): FoldingRange[];
}

export interface LanguageSettings {
	validate?: boolean;
	lint?: any;
}

Development

How can I run and debug this node module

  • clone, npm install
  • open the folder in VSCode.
  • set breakpoints, e.g. in cssCompletion.ts
  • run JUnit tests from the debug viewlet and wait until a breakpoint is hit: image

In VSCode:

  • run VSCode out of sources as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
    • in the instance run from sources open a .css file
  • open a VSCode on the VSCode source
    • run command Debug: Attach to Node process and pick the process with the css-language-features path
    • Set a breakpoint in extensions/css-language-features/server/node_modules/vscode-css-languageservice/lib/umd/services/cssCompletion.js
  • in the instance run from sources invoke code completion in the .css file
  • use yarn link vscode-css-languageservice in extensions/css-language-features/server to run VSCode with your changes to vscode-css-languageservice

License

(MIT License)

Copyright 2016, Microsoft

With the exceptions of build/mdn-documentation.js, which is built upon content from Mozilla Developer Network and distributed under CC BY-SA 2.5.

vscode-css-languageservice's People

Contributors

aeschli avatar amiller-gh avatar andrienkoaleksandr avatar avivahl avatar connorshea avatar joaomoreno avatar kamasamak avatar kiricon avatar kristerkari avatar kumarharsh avatar lannonbr avatar lesleh avatar matthew-dean avatar mrmlnc avatar msftgits avatar octref avatar praveenpuglia avatar ragnoroct avatar ramya-rao-a avatar rebornix avatar rictic avatar rocifier avatar tlent avatar tyriar avatar ubershmekel avatar usernamehw avatar yume-chan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.