modern-monaco 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -6
- package/dist/core.mjs +1 -1
- package/dist/lsp/css/setup.mjs +2 -2
- package/dist/lsp/html/setup.mjs +2 -1
- package/dist/lsp/json/setup.mjs +4 -2
- package/package.json +1 -1
- package/types/lsp.d.ts +33 -2
package/README.md
CHANGED
|
@@ -309,29 +309,69 @@ You can configure built-in LSPs in the `lazy`, `init`, or `hydrate` functions.
|
|
|
309
309
|
|
|
310
310
|
```js
|
|
311
311
|
lazy({
|
|
312
|
-
// configure LSP for each language
|
|
313
312
|
lsp: {
|
|
313
|
+
// formatting options for all languages
|
|
314
|
+
formatting: {/* ... */},
|
|
315
|
+
// configure LSP for languages
|
|
314
316
|
html: {/* ... */},
|
|
317
|
+
css: {/* ... */},
|
|
315
318
|
json: {/* ... */},
|
|
316
319
|
typescript: {/* ... */},
|
|
317
320
|
},
|
|
318
321
|
});
|
|
319
322
|
```
|
|
320
323
|
|
|
321
|
-
The `
|
|
324
|
+
The `LSPConfig` interface is defined as:
|
|
322
325
|
|
|
323
326
|
```ts
|
|
324
|
-
export interface
|
|
327
|
+
export interface LSPConfig {
|
|
328
|
+
/** Formatting options. */
|
|
329
|
+
formatting?: {
|
|
330
|
+
/** Size of a tab in spaces. Default: 4. */
|
|
331
|
+
tabSize?: number;
|
|
332
|
+
/** Prefer spaces over tabs. Default: true.*/
|
|
333
|
+
insertSpaces?: boolean;
|
|
334
|
+
/** Trim trailing whitespace on a line. Default: true. */
|
|
335
|
+
trimTrailingWhitespace?: boolean;
|
|
336
|
+
/** Insert a newline character at the end of the file if one does not exist. Default: false. */
|
|
337
|
+
insertFinalNewline?: boolean;
|
|
338
|
+
/** Trim all newlines after the final newline at the end of the file. Default: false. */
|
|
339
|
+
trimFinalNewlines?: boolean;
|
|
340
|
+
/** Semicolon preference for JavaScript and TypeScript. Default: "insert". */
|
|
341
|
+
semicolon?: "ignore" | "insert" | "remove";
|
|
342
|
+
}
|
|
343
|
+
/** HTML language configuration. */
|
|
325
344
|
html?: {
|
|
326
345
|
attributeDefaultValue?: "empty" | "singlequotes" | "doublequotes";
|
|
327
346
|
customTags?: ITagData[];
|
|
328
347
|
hideAutoCompleteProposals?: boolean;
|
|
348
|
+
hideEndTagSuggestions?: boolean;
|
|
329
349
|
};
|
|
330
|
-
|
|
350
|
+
/** CSS language configuration. */
|
|
351
|
+
css?: {
|
|
352
|
+
/** Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. */
|
|
353
|
+
useDefaultDataProvider?: boolean;
|
|
354
|
+
/** Provides a set of custom data providers. */
|
|
355
|
+
dataProviders?: { [providerId: string]: CSSDataV1 };
|
|
356
|
+
};
|
|
357
|
+
/** JSON language configuration. */
|
|
331
358
|
json?: {
|
|
332
|
-
|
|
333
|
-
|
|
359
|
+
/** By default, the validator will return syntax and semantic errors. Set to false to disable the validator. */
|
|
360
|
+
validate?: boolean;
|
|
361
|
+
/** Defines whether comments are allowed or not. Default is disallowed. */
|
|
362
|
+
allowComments?: boolean;
|
|
363
|
+
/** A list of known schemas and/or associations of schemas to file names. */
|
|
364
|
+
schemas?: JSONSchemaSource[];
|
|
365
|
+
/** The severity of reported comments. Default is "error". */
|
|
366
|
+
comments?: SeverityLevel;
|
|
367
|
+
/** The severity of reported trailing commas. Default is "error". */
|
|
368
|
+
trailingCommas?: SeverityLevel;
|
|
369
|
+
/** The severity of problems from schema validation. Default is "warning". */
|
|
370
|
+
schemaValidation?: SeverityLevel;
|
|
371
|
+
/** The severity of problems that occurred when resolving and loading schemas. Default is "warning". */
|
|
372
|
+
schemaRequest?: SeverityLevel;
|
|
334
373
|
};
|
|
374
|
+
/** TypeScript language configuration. */
|
|
335
375
|
typescript?: {
|
|
336
376
|
/** The compiler options. */
|
|
337
377
|
compilerOptions?: ts.CompilerOptions;
|
package/dist/core.mjs
CHANGED
package/dist/lsp/css/setup.mjs
CHANGED
|
@@ -5,8 +5,8 @@ async function setup(monaco, languageId, languageSettings, formattingOptions, wo
|
|
|
5
5
|
const createData = {
|
|
6
6
|
language: languageId,
|
|
7
7
|
data: {
|
|
8
|
-
useDefaultDataProvider: true
|
|
9
|
-
|
|
8
|
+
useDefaultDataProvider: true,
|
|
9
|
+
...languageSettings
|
|
10
10
|
},
|
|
11
11
|
format: {
|
|
12
12
|
tabSize,
|
package/dist/lsp/html/setup.mjs
CHANGED
|
@@ -5,8 +5,9 @@ async function setup(monaco, languageId, languageSettings, formattingOptions, wo
|
|
|
5
5
|
const { tabSize, insertSpaces, insertFinalNewline, trimFinalNewlines } = formattingOptions ?? {};
|
|
6
6
|
const createData = {
|
|
7
7
|
suggest: {
|
|
8
|
+
attributeDefaultValue: languageSettings?.attributeDefaultValue,
|
|
8
9
|
hideAutoCompleteProposals: languageSettings?.hideAutoCompleteProposals,
|
|
9
|
-
|
|
10
|
+
hideEndTagSuggestions: languageSettings?.hideEndTagSuggestions
|
|
10
11
|
},
|
|
11
12
|
format: {
|
|
12
13
|
tabSize,
|
package/dist/lsp/json/setup.mjs
CHANGED
|
@@ -114,15 +114,17 @@ var schemas = [
|
|
|
114
114
|
import * as client from "../client.mjs";
|
|
115
115
|
async function setup(monaco, languageId, languageSettings, formattingOptions, workspace) {
|
|
116
116
|
const { editor, languages } = monaco;
|
|
117
|
+
const schemas2 = Array.isArray(languageSettings?.schemas) ? schemas.concat(languageSettings.schemas) : schemas;
|
|
117
118
|
const createData = {
|
|
118
119
|
settings: {
|
|
119
120
|
validate: true,
|
|
120
121
|
allowComments: false,
|
|
121
|
-
schemas: Array.isArray(languageSettings?.schemas) ? schemas.concat(languageSettings.schemas) : schemas,
|
|
122
122
|
comments: "error",
|
|
123
123
|
trailingCommas: "error",
|
|
124
124
|
schemaRequest: "warning",
|
|
125
|
-
schemaValidation: "warning"
|
|
125
|
+
schemaValidation: "warning",
|
|
126
|
+
...languageSettings,
|
|
127
|
+
schemas: schemas2
|
|
126
128
|
},
|
|
127
129
|
format: {
|
|
128
130
|
tabSize: 4,
|
package/package.json
CHANGED
package/types/lsp.d.ts
CHANGED
|
@@ -52,15 +52,18 @@ export interface IReference {
|
|
|
52
52
|
name: string;
|
|
53
53
|
url: string;
|
|
54
54
|
}
|
|
55
|
+
|
|
55
56
|
export interface IData {
|
|
56
57
|
name: string;
|
|
57
58
|
description?: string;
|
|
58
59
|
references?: IReference[];
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
export interface IAttributeData extends IData {
|
|
61
63
|
valueSet?: string;
|
|
62
64
|
values?: IData[];
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
export interface ITagData extends IData {
|
|
65
68
|
attributes: IAttributeData[];
|
|
66
69
|
void?: boolean;
|
|
@@ -87,17 +90,45 @@ export interface LSPConfig extends LSPLanguageConfig {
|
|
|
87
90
|
formatting?: FormatOptions;
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
export type SeverityLevel = "error" | "warning" | "ignore";
|
|
94
|
+
|
|
95
|
+
export interface CSSDataV1 {
|
|
96
|
+
version: 1 | 1.1;
|
|
97
|
+
properties?: (IData & Record<string, unknown>)[];
|
|
98
|
+
atDirectives?: (IData & Record<string, unknown>)[];
|
|
99
|
+
pseudoClasses?: (IData & Record<string, unknown>)[];
|
|
100
|
+
pseudoElements?: (IData & Record<string, unknown>)[];
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
declare global {
|
|
91
104
|
interface LSPLanguageConfig {
|
|
92
105
|
html?: {
|
|
93
106
|
attributeDefaultValue?: "empty" | "singlequotes" | "doublequotes";
|
|
94
107
|
customTags?: ITagData[];
|
|
108
|
+
hideEndTagSuggestions?: boolean;
|
|
95
109
|
hideAutoCompleteProposals?: boolean;
|
|
96
110
|
};
|
|
97
|
-
css?: {
|
|
111
|
+
css?: {
|
|
112
|
+
/** Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown. */
|
|
113
|
+
useDefaultDataProvider?: boolean;
|
|
114
|
+
/** Provides a set of custom data providers. */
|
|
115
|
+
dataProviders?: { [providerId: string]: CSSDataV1 };
|
|
116
|
+
};
|
|
98
117
|
json?: {
|
|
99
|
-
/**
|
|
118
|
+
/** By default, the validator will return syntax and semantic errors. Set to false to disable the validator. */
|
|
119
|
+
validate?: boolean;
|
|
120
|
+
/** Defines whether comments are allowed or not. Default is disallowed. */
|
|
121
|
+
allowComments?: boolean;
|
|
122
|
+
/** A list of known schemas and/or associations of schemas to file names. */
|
|
100
123
|
schemas?: JSONSchemaSource[];
|
|
124
|
+
/** The severity of reported comments. Default is "error". */
|
|
125
|
+
comments?: SeverityLevel;
|
|
126
|
+
/** The severity of reported trailing commas. Default is "error". */
|
|
127
|
+
trailingCommas?: SeverityLevel;
|
|
128
|
+
/** The severity of problems from schema validation. Default is "warning". */
|
|
129
|
+
schemaValidation?: SeverityLevel;
|
|
130
|
+
/** The severity of problems that occurred when resolving and loading schemas. Default is "warning". */
|
|
131
|
+
schemaRequest?: SeverityLevel;
|
|
101
132
|
};
|
|
102
133
|
typescript?: {
|
|
103
134
|
/** The compiler options. */
|