adopt css formatter

pull/3052/head
Martin Aeschlimann 3 years ago
parent d001070938
commit 290a62d727
No known key found for this signature in database
GPG Key ID: 2609A01E695523E3

58
package-lock.json generated

@ -30,9 +30,9 @@
"ts-node": "^10.6.0", "ts-node": "^10.6.0",
"typedoc": "^0.22.11", "typedoc": "^0.22.11",
"typescript": "4.5.5", "typescript": "4.5.5",
"vscode-css-languageservice": "^5.1.12", "vscode-css-languageservice": "5.3.0",
"vscode-html-languageservice": "^4.2.1", "vscode-html-languageservice": "4.2.4",
"vscode-json-languageservice": "4.2.0", "vscode-json-languageservice": "4.2.1",
"vscode-languageserver-textdocument": "^1.0.4", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "3.16.0", "vscode-languageserver-types": "3.16.0",
"vscode-uri": "3.0.3", "vscode-uri": "3.0.3",
@ -2488,33 +2488,33 @@
"dev": true "dev": true
}, },
"node_modules/vscode-css-languageservice": { "node_modules/vscode-css-languageservice": {
"version": "5.1.12", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-5.1.12.tgz", "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-5.3.0.tgz",
"integrity": "sha512-293C5C2732Rbhh3opTs+nQBpC5Dd+oYrEA8lc0OWdyt40oYmJ331FV7NMF1SLFSIcOFB5XveLiWUZak2oyc49Q==", "integrity": "sha512-ujWW855AoJlE4ETU17Gff7unlZZTHDA0w26itk9EQFMfJqi9lE6S67zOsMvcPmJf55MrnGQbojDYZRiDVaFjdA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "^3.16.0", "vscode-languageserver-types": "^3.16.0",
"vscode-nls": "^5.0.0", "vscode-nls": "^5.0.0",
"vscode-uri": "^3.0.2" "vscode-uri": "^3.0.3"
} }
}, },
"node_modules/vscode-html-languageservice": { "node_modules/vscode-html-languageservice": {
"version": "4.2.1", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-4.2.1.tgz", "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-4.2.4.tgz",
"integrity": "sha512-PgaToZVXJ44nFWEBuSINdDgVV6EnpC3MnXBsysR3O5TKcAfywbYeRGRy+Y4dVR7YeUgDvtb+JkJoSkaYC0mxXQ==", "integrity": "sha512-1HqvXKOq9WlZyW4HTD+0XzrjZoZ/YFrgQY2PZqktbRloHXVAUKm6+cAcvZi4YqKPVn05/CK7do+KBHfuSaEdbg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "^3.16.0", "vscode-languageserver-types": "^3.16.0",
"vscode-nls": "^5.0.0", "vscode-nls": "^5.0.0",
"vscode-uri": "^3.0.2" "vscode-uri": "^3.0.3"
} }
}, },
"node_modules/vscode-json-languageservice": { "node_modules/vscode-json-languageservice": {
"version": "4.2.0", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.2.0.tgz", "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.2.1.tgz",
"integrity": "sha512-XNawv0Vdy/sUK0S+hGf7cq/qsVAbIniGJr89TvZOqMCNJmpgKTy1e8PL1aWW0uy6BfWMG7vxa5lZb3ypuFtuGQ==", "integrity": "sha512-xGmv9QIWs2H8obGbWg+sIPI/3/pFgj/5OWBhNzs00BkYQ9UaB2F6JJaGB/2/YOZJ3BvLXQTC4Q7muqU25QgAhA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"jsonc-parser": "^3.0.0", "jsonc-parser": "^3.0.0",
@ -4601,33 +4601,33 @@
"dev": true "dev": true
}, },
"vscode-css-languageservice": { "vscode-css-languageservice": {
"version": "5.1.12", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-5.1.12.tgz", "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-5.3.0.tgz",
"integrity": "sha512-293C5C2732Rbhh3opTs+nQBpC5Dd+oYrEA8lc0OWdyt40oYmJ331FV7NMF1SLFSIcOFB5XveLiWUZak2oyc49Q==", "integrity": "sha512-ujWW855AoJlE4ETU17Gff7unlZZTHDA0w26itk9EQFMfJqi9lE6S67zOsMvcPmJf55MrnGQbojDYZRiDVaFjdA==",
"dev": true, "dev": true,
"requires": { "requires": {
"vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "^3.16.0", "vscode-languageserver-types": "^3.16.0",
"vscode-nls": "^5.0.0", "vscode-nls": "^5.0.0",
"vscode-uri": "^3.0.2" "vscode-uri": "^3.0.3"
} }
}, },
"vscode-html-languageservice": { "vscode-html-languageservice": {
"version": "4.2.1", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-4.2.1.tgz", "resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-4.2.4.tgz",
"integrity": "sha512-PgaToZVXJ44nFWEBuSINdDgVV6EnpC3MnXBsysR3O5TKcAfywbYeRGRy+Y4dVR7YeUgDvtb+JkJoSkaYC0mxXQ==", "integrity": "sha512-1HqvXKOq9WlZyW4HTD+0XzrjZoZ/YFrgQY2PZqktbRloHXVAUKm6+cAcvZi4YqKPVn05/CK7do+KBHfuSaEdbg==",
"dev": true, "dev": true,
"requires": { "requires": {
"vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "^3.16.0", "vscode-languageserver-types": "^3.16.0",
"vscode-nls": "^5.0.0", "vscode-nls": "^5.0.0",
"vscode-uri": "^3.0.2" "vscode-uri": "^3.0.3"
} }
}, },
"vscode-json-languageservice": { "vscode-json-languageservice": {
"version": "4.2.0", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.2.0.tgz", "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.2.1.tgz",
"integrity": "sha512-XNawv0Vdy/sUK0S+hGf7cq/qsVAbIniGJr89TvZOqMCNJmpgKTy1e8PL1aWW0uy6BfWMG7vxa5lZb3ypuFtuGQ==", "integrity": "sha512-xGmv9QIWs2H8obGbWg+sIPI/3/pFgj/5OWBhNzs00BkYQ9UaB2F6JJaGB/2/YOZJ3BvLXQTC4Q7muqU25QgAhA==",
"dev": true, "dev": true,
"requires": { "requires": {
"jsonc-parser": "^3.0.0", "jsonc-parser": "^3.0.0",

@ -53,9 +53,9 @@
"ts-node": "^10.6.0", "ts-node": "^10.6.0",
"typedoc": "^0.22.11", "typedoc": "^0.22.11",
"typescript": "4.5.5", "typescript": "4.5.5",
"vscode-css-languageservice": "^5.1.12", "vscode-css-languageservice": "5.3.0",
"vscode-html-languageservice": "^4.2.1", "vscode-html-languageservice": "4.2.4",
"vscode-json-languageservice": "4.2.0", "vscode-json-languageservice": "4.2.1",
"vscode-languageserver-textdocument": "^1.0.4", "vscode-languageserver-textdocument": "^1.0.4",
"vscode-languageserver-types": "3.16.0", "vscode-languageserver-types": "3.16.0",
"vscode-uri": "3.0.3", "vscode-uri": "3.0.3",

@ -106,6 +106,22 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
) )
); );
} }
if (modeConfiguration.documentFormattingEdits) {
providers.push(
languages.registerDocumentFormattingEditProvider(
languageId,
new languageFeatures.DocumentFormattingEditProvider(worker)
)
);
}
if (modeConfiguration.documentRangeFormattingEdits) {
providers.push(
languages.registerDocumentRangeFormattingEditProvider(
languageId,
new languageFeatures.DocumentRangeFormattingEditProvider(worker)
)
);
}
} }
registerProviders(); registerProviders();

@ -12,7 +12,7 @@ export class CSSWorker {
private _ctx: worker.IWorkerContext; private _ctx: worker.IWorkerContext;
private _languageService: cssService.LanguageService; private _languageService: cssService.LanguageService;
private _languageSettings: cssService.LanguageSettings; private _languageSettings: Options;
private _languageId: string; private _languageId: string;
constructor(ctx: worker.IWorkerContext, createData: ICreateData) { constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
@ -53,10 +53,10 @@ export class CSSWorker {
// --- language service host --------------- // --- language service host ---------------
async doValidation(uri: string): Promise<cssService.Diagnostic[]> { async doValidation(uri: string): Promise<cssService.Diagnostic[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (document) { if (document) {
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let diagnostics = this._languageService.doValidation(document, stylesheet); const diagnostics = this._languageService.doValidation(document, stylesheet);
return Promise.resolve(diagnostics); return Promise.resolve(diagnostics);
} }
return Promise.resolve([]); return Promise.resolve([]);
@ -65,63 +65,63 @@ export class CSSWorker {
uri: string, uri: string,
position: cssService.Position position: cssService.Position
): Promise<cssService.CompletionList | null> { ): Promise<cssService.CompletionList | null> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return null; return null;
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let completions = this._languageService.doComplete(document, position, stylesheet); const completions = this._languageService.doComplete(document, position, stylesheet);
return Promise.resolve(completions); return Promise.resolve(completions);
} }
async doHover(uri: string, position: cssService.Position): Promise<cssService.Hover | null> { async doHover(uri: string, position: cssService.Position): Promise<cssService.Hover | null> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return null; return null;
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let hover = this._languageService.doHover(document, position, stylesheet); const hover = this._languageService.doHover(document, position, stylesheet);
return Promise.resolve(hover); return Promise.resolve(hover);
} }
async findDefinition( async findDefinition(
uri: string, uri: string,
position: cssService.Position position: cssService.Position
): Promise<cssService.Location | null> { ): Promise<cssService.Location | null> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return null; return null;
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let definition = this._languageService.findDefinition(document, position, stylesheet); const definition = this._languageService.findDefinition(document, position, stylesheet);
return Promise.resolve(definition); return Promise.resolve(definition);
} }
async findReferences(uri: string, position: cssService.Position): Promise<cssService.Location[]> { async findReferences(uri: string, position: cssService.Position): Promise<cssService.Location[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let references = this._languageService.findReferences(document, position, stylesheet); const references = this._languageService.findReferences(document, position, stylesheet);
return Promise.resolve(references); return Promise.resolve(references);
} }
async findDocumentHighlights( async findDocumentHighlights(
uri: string, uri: string,
position: cssService.Position position: cssService.Position
): Promise<cssService.DocumentHighlight[]> { ): Promise<cssService.DocumentHighlight[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let highlights = this._languageService.findDocumentHighlights(document, position, stylesheet); const highlights = this._languageService.findDocumentHighlights(document, position, stylesheet);
return Promise.resolve(highlights); return Promise.resolve(highlights);
} }
async findDocumentSymbols(uri: string): Promise<cssService.SymbolInformation[]> { async findDocumentSymbols(uri: string): Promise<cssService.SymbolInformation[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let symbols = this._languageService.findDocumentSymbols(document, stylesheet); const symbols = this._languageService.findDocumentSymbols(document, stylesheet);
return Promise.resolve(symbols); return Promise.resolve(symbols);
} }
async doCodeActions( async doCodeActions(
@ -129,21 +129,21 @@ export class CSSWorker {
range: cssService.Range, range: cssService.Range,
context: cssService.CodeActionContext context: cssService.CodeActionContext
): Promise<cssService.Command[]> { ): Promise<cssService.Command[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let actions = this._languageService.doCodeActions(document, range, context, stylesheet); const actions = this._languageService.doCodeActions(document, range, context, stylesheet);
return Promise.resolve(actions); return Promise.resolve(actions);
} }
async findDocumentColors(uri: string): Promise<cssService.ColorInformation[]> { async findDocumentColors(uri: string): Promise<cssService.ColorInformation[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let colorSymbols = this._languageService.findDocumentColors(document, stylesheet); const colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
return Promise.resolve(colorSymbols); return Promise.resolve(colorSymbols);
} }
async getColorPresentations( async getColorPresentations(
@ -151,12 +151,12 @@ export class CSSWorker {
color: cssService.Color, color: cssService.Color,
range: cssService.Range range: cssService.Range
): Promise<cssService.ColorPresentation[]> { ): Promise<cssService.ColorPresentation[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let colorPresentations = this._languageService.getColorPresentations( const colorPresentations = this._languageService.getColorPresentations(
document, document,
stylesheet, stylesheet,
color, color,
@ -168,23 +168,23 @@ export class CSSWorker {
uri: string, uri: string,
context?: { rangeLimit?: number } context?: { rangeLimit?: number }
): Promise<cssService.FoldingRange[]> { ): Promise<cssService.FoldingRange[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let ranges = this._languageService.getFoldingRanges(document, context); const ranges = this._languageService.getFoldingRanges(document, context);
return Promise.resolve(ranges); return Promise.resolve(ranges);
} }
async getSelectionRanges( async getSelectionRanges(
uri: string, uri: string,
positions: cssService.Position[] positions: cssService.Position[]
): Promise<cssService.SelectionRange[]> { ): Promise<cssService.SelectionRange[]> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return []; return [];
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let ranges = this._languageService.getSelectionRanges(document, positions, stylesheet); const ranges = this._languageService.getSelectionRanges(document, positions, stylesheet);
return Promise.resolve(ranges); return Promise.resolve(ranges);
} }
async doRename( async doRename(
@ -192,17 +192,30 @@ export class CSSWorker {
position: cssService.Position, position: cssService.Position,
newName: string newName: string
): Promise<cssService.WorkspaceEdit | null> { ): Promise<cssService.WorkspaceEdit | null> {
let document = this._getTextDocument(uri); const document = this._getTextDocument(uri);
if (!document) { if (!document) {
return null; return null;
} }
let stylesheet = this._languageService.parseStylesheet(document); const stylesheet = this._languageService.parseStylesheet(document);
let renames = this._languageService.doRename(document, position, newName, stylesheet); const renames = this._languageService.doRename(document, position, newName, stylesheet);
return Promise.resolve(renames); return Promise.resolve(renames);
} }
async format(
uri: string,
range: cssService.Range | null,
options: cssService.CSSFormatConfiguration
): Promise<cssService.TextEdit[]> {
const document = this._getTextDocument(uri);
if (!document) {
return [];
}
const settings = { ...this._languageSettings.format, ...options };
const textEdits = this._languageService.format(document, range! /* TODO */, settings);
return Promise.resolve(textEdits);
}
private _getTextDocument(uri: string): cssService.TextDocument | null { private _getTextDocument(uri: string): cssService.TextDocument | null {
let models = this._ctx.getMirrorModels(); const models = this._ctx.getMirrorModels();
for (let model of models) { for (const model of models) {
if (model.uri.toString() === uri) { if (model.uri.toString() === uri) {
return cssService.TextDocument.create( return cssService.TextDocument.create(
uri, uri,

@ -6,6 +6,15 @@
import * as mode from './cssMode'; import * as mode from './cssMode';
import { languages, Emitter, IEvent } from '../../fillers/monaco-editor-core'; import { languages, Emitter, IEvent } from '../../fillers/monaco-editor-core';
export interface CSSFormatConfiguration {
/** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */
newlineBetweenSelectors?: boolean;
/** add a new line after every css rule: Default: true */
newlineBetweenRules?: boolean;
/** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */
spaceAroundSelectorSeparator?: boolean;
}
export interface Options { export interface Options {
readonly validate?: boolean; readonly validate?: boolean;
readonly lint?: { readonly lint?: {
@ -32,6 +41,11 @@ export interface Options {
* Configures the CSS data types known by the langauge service. * Configures the CSS data types known by the langauge service.
*/ */
readonly data?: CSSDataConfiguration; readonly data?: CSSDataConfiguration;
/**
* Settings for the CSS formatter.
*/
readonly format?: CSSFormatConfiguration;
} }
export interface ModeConfiguration { export interface ModeConfiguration {
@ -89,6 +103,16 @@ export interface ModeConfiguration {
* Defines whether the built-in selection range provider is enabled. * Defines whether the built-in selection range provider is enabled.
*/ */
readonly selectionRanges?: boolean; readonly selectionRanges?: boolean;
/**
* Defines whether the built-in document formatting edit provider is enabled.
*/
readonly documentFormattingEdits?: boolean;
/**
* Defines whether the built-in document formatting range edit provider is enabled.
*/
readonly documentRangeFormattingEdits?: boolean;
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {
@ -180,7 +204,12 @@ const optionsDefault: Required<Options> = {
float: 'ignore', float: 'ignore',
idSelector: 'ignore' idSelector: 'ignore'
}, },
data: { useDefaultDataProvider: true } data: { useDefaultDataProvider: true },
format: {
newlineBetweenSelectors: true,
newlineBetweenRules: true,
spaceAroundSelectorSeparator: false
}
}; };
const modeConfigurationDefault: Required<ModeConfiguration> = { const modeConfigurationDefault: Required<ModeConfiguration> = {
@ -194,7 +223,9 @@ const modeConfigurationDefault: Required<ModeConfiguration> = {
colors: true, colors: true,
foldingRanges: true, foldingRanges: true,
diagnostics: true, diagnostics: true,
selectionRanges: true selectionRanges: true,
documentFormattingEdits: true,
documentRangeFormattingEdits: true
}; };
export const cssDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl( export const cssDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(

@ -27,11 +27,11 @@ export interface CompletionConfiguration {
export interface Options { export interface Options {
/** /**
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. * Settings for the HTML formatter.
*/ */
readonly format?: HTMLFormatConfiguration; readonly format?: HTMLFormatConfiguration;
/** /**
* A list of known schemas and/or associations of schemas to file names. * Code completion settings.
*/ */
readonly suggest?: CompletionConfiguration; readonly suggest?: CompletionConfiguration;
/** /**

@ -7157,6 +7157,14 @@ declare namespace monaco.worker {
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
declare namespace monaco.languages.css { declare namespace monaco.languages.css {
export interface CSSFormatConfiguration {
/** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */
newlineBetweenSelectors?: boolean;
/** add a new line after every css rule: Default: true */
newlineBetweenRules?: boolean;
/** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */
spaceAroundSelectorSeparator?: boolean;
}
export interface Options { export interface Options {
readonly validate?: boolean; readonly validate?: boolean;
readonly lint?: { readonly lint?: {
@ -7183,6 +7191,10 @@ declare namespace monaco.languages.css {
* Configures the CSS data types known by the langauge service. * Configures the CSS data types known by the langauge service.
*/ */
readonly data?: CSSDataConfiguration; readonly data?: CSSDataConfiguration;
/**
* Settings for the CSS formatter.
*/
readonly format?: CSSFormatConfiguration;
} }
export interface ModeConfiguration { export interface ModeConfiguration {
/** /**
@ -7229,6 +7241,14 @@ declare namespace monaco.languages.css {
* Defines whether the built-in selection range provider is enabled. * Defines whether the built-in selection range provider is enabled.
*/ */
readonly selectionRanges?: boolean; readonly selectionRanges?: boolean;
/**
* Defines whether the built-in document formatting edit provider is enabled.
*/
readonly documentFormattingEdits?: boolean;
/**
* Defines whether the built-in document formatting range edit provider is enabled.
*/
readonly documentRangeFormattingEdits?: boolean;
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {
readonly languageId: string; readonly languageId: string;
@ -7346,11 +7366,11 @@ declare namespace monaco.languages.html {
} }
export interface Options { export interface Options {
/** /**
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. * Settings for the HTML formatter.
*/ */
readonly format?: HTMLFormatConfiguration; readonly format?: HTMLFormatConfiguration;
/** /**
* A list of known schemas and/or associations of schemas to file names. * Conde completion settings.
*/ */
readonly suggest?: CompletionConfiguration; readonly suggest?: CompletionConfiguration;
/** /**

@ -7157,6 +7157,14 @@ declare namespace monaco.worker {
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
declare namespace monaco.languages.css { declare namespace monaco.languages.css {
export interface CSSFormatConfiguration {
/** separate selectors with newline (e.g. "a,\nbr" or "a, br"): Default: true */
newlineBetweenSelectors?: boolean;
/** add a new line after every css rule: Default: true */
newlineBetweenRules?: boolean;
/** ensure space around selector separators: '>', '+', '~' (e.g. "a>b" -> "a > b"): Default: false */
spaceAroundSelectorSeparator?: boolean;
}
export interface Options { export interface Options {
readonly validate?: boolean; readonly validate?: boolean;
readonly lint?: { readonly lint?: {
@ -7183,6 +7191,10 @@ declare namespace monaco.languages.css {
* Configures the CSS data types known by the langauge service. * Configures the CSS data types known by the langauge service.
*/ */
readonly data?: CSSDataConfiguration; readonly data?: CSSDataConfiguration;
/**
* Settings for the CSS formatter.
*/
readonly format?: CSSFormatConfiguration;
} }
export interface ModeConfiguration { export interface ModeConfiguration {
/** /**
@ -7229,6 +7241,14 @@ declare namespace monaco.languages.css {
* Defines whether the built-in selection range provider is enabled. * Defines whether the built-in selection range provider is enabled.
*/ */
readonly selectionRanges?: boolean; readonly selectionRanges?: boolean;
/**
* Defines whether the built-in document formatting edit provider is enabled.
*/
readonly documentFormattingEdits?: boolean;
/**
* Defines whether the built-in document formatting range edit provider is enabled.
*/
readonly documentRangeFormattingEdits?: boolean;
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {
readonly languageId: string; readonly languageId: string;
@ -7346,11 +7366,11 @@ declare namespace monaco.languages.html {
} }
export interface Options { export interface Options {
/** /**
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments. * Settings for the HTML formatter.
*/ */
readonly format?: HTMLFormatConfiguration; readonly format?: HTMLFormatConfiguration;
/** /**
* A list of known schemas and/or associations of schemas to file names. * Conde completion settings.
*/ */
readonly suggest?: CompletionConfiguration; readonly suggest?: CompletionConfiguration;
/** /**

Loading…
Cancel
Save