@codingame/monaco-vscode-standalone-html-language-features 23.2.0 → 23.2.1

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.
@@ -0,0 +1,29 @@
1
+ import { editor } from "@codingame/monaco-vscode-api/vscode/vs/editor/editor.api.js";
2
+ declare function createWebWorker<T extends object>(opts: IWebWorkerOptions): editor.MonacoWebWorker<T>;
3
+ interface IWebWorkerOptions {
4
+ /**
5
+ * The AMD moduleId to load.
6
+ * It should export a function `create` that should return the exported proxy.
7
+ */
8
+ moduleId: string;
9
+ createWorker?: () => Worker;
10
+ /**
11
+ * The data to send over when calling create on the module.
12
+ */
13
+ createData?: any;
14
+ /**
15
+ * A label to be used to identify the web worker for debugging purposes.
16
+ */
17
+ label?: string;
18
+ /**
19
+ * An object that can be used by the web worker to make calls back to the main thread.
20
+ */
21
+ host?: any;
22
+ /**
23
+ * Keep idle models.
24
+ * Defaults to false, which means that idle models will stop syncing after a while.
25
+ */
26
+ keepIdleModels?: boolean;
27
+ }
28
+ export { createWebWorker };
29
+ export type { IWebWorkerOptions };
package/common/workers.js CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  import { editor } from 'monaco-editor';
2
3
 
3
4
  function createTrustedTypesPolicy(policyName, policyOptions) {
@@ -0,0 +1,162 @@
1
+ import { IEvent, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/editor/editor.api.js";
2
+ interface HTMLFormatConfiguration {
3
+ readonly tabSize: number;
4
+ readonly insertSpaces: boolean;
5
+ readonly wrapLineLength: number;
6
+ readonly unformatted: string;
7
+ readonly contentUnformatted: string;
8
+ readonly indentInnerHtml: boolean;
9
+ readonly preserveNewLines: boolean;
10
+ readonly maxPreserveNewLines: number | undefined;
11
+ readonly indentHandlebars: boolean;
12
+ readonly endWithNewline: boolean;
13
+ readonly extraLiners: string;
14
+ readonly wrapAttributes: "auto" | "force" | "force-aligned" | "force-expand-multiline";
15
+ }
16
+ interface CompletionConfiguration {
17
+ readonly [providerId: string]: boolean;
18
+ }
19
+ interface Options {
20
+ /**
21
+ * Settings for the HTML formatter.
22
+ */
23
+ readonly format?: HTMLFormatConfiguration;
24
+ /**
25
+ * Code completion settings.
26
+ */
27
+ readonly suggest?: CompletionConfiguration;
28
+ /**
29
+ * Configures the HTML data types known by the HTML langauge service.
30
+ */
31
+ readonly data?: HTMLDataConfiguration;
32
+ }
33
+ interface ModeConfiguration {
34
+ /**
35
+ * Defines whether the built-in completionItemProvider is enabled.
36
+ */
37
+ readonly completionItems?: boolean;
38
+ /**
39
+ * Defines whether the built-in hoverProvider is enabled.
40
+ */
41
+ readonly hovers?: boolean;
42
+ /**
43
+ * Defines whether the built-in documentSymbolProvider is enabled.
44
+ */
45
+ readonly documentSymbols?: boolean;
46
+ /**
47
+ * Defines whether the built-in definitions provider is enabled.
48
+ */
49
+ readonly links?: boolean;
50
+ /**
51
+ * Defines whether the built-in references provider is enabled.
52
+ */
53
+ readonly documentHighlights?: boolean;
54
+ /**
55
+ * Defines whether the built-in rename provider is enabled.
56
+ */
57
+ readonly rename?: boolean;
58
+ /**
59
+ * Defines whether the built-in color provider is enabled.
60
+ */
61
+ readonly colors?: boolean;
62
+ /**
63
+ * Defines whether the built-in foldingRange provider is enabled.
64
+ */
65
+ readonly foldingRanges?: boolean;
66
+ /**
67
+ * Defines whether the built-in diagnostic provider is enabled.
68
+ */
69
+ readonly diagnostics?: boolean;
70
+ /**
71
+ * Defines whether the built-in selection range provider is enabled.
72
+ */
73
+ readonly selectionRanges?: boolean;
74
+ /**
75
+ * Defines whether the built-in documentFormattingEdit provider is enabled.
76
+ */
77
+ readonly documentFormattingEdits?: boolean;
78
+ /**
79
+ * Defines whether the built-in documentRangeFormattingEdit provider is enabled.
80
+ */
81
+ readonly documentRangeFormattingEdits?: boolean;
82
+ }
83
+ interface LanguageServiceDefaults {
84
+ readonly languageId: string;
85
+ readonly modeConfiguration: ModeConfiguration;
86
+ readonly onDidChange: IEvent<LanguageServiceDefaults>;
87
+ readonly options: Options;
88
+ setOptions(options: Options): void;
89
+ setModeConfiguration(modeConfiguration: ModeConfiguration): void;
90
+ }
91
+ declare const htmlLanguageService: LanguageServiceRegistration;
92
+ declare const htmlDefaults: LanguageServiceDefaults;
93
+ declare const handlebarLanguageService: LanguageServiceRegistration;
94
+ declare const handlebarDefaults: LanguageServiceDefaults;
95
+ declare const razorLanguageService: LanguageServiceRegistration;
96
+ declare const razorDefaults: LanguageServiceDefaults;
97
+ interface LanguageServiceRegistration extends IDisposable {
98
+ readonly defaults: LanguageServiceDefaults;
99
+ }
100
+ /**
101
+ * Registers a new HTML language service for the languageId.
102
+ * Note: 'html', 'handlebar' and 'razor' are registered by default.
103
+ *
104
+ * Use this method to register additional language ids with a HTML service.
105
+ * The language server has to be registered before an editor model is opened.
106
+ */
107
+ declare function registerHTMLLanguageService(languageId: string, options?: Options, modeConfiguration?: ModeConfiguration): LanguageServiceRegistration;
108
+ interface HTMLDataConfiguration {
109
+ /**
110
+ * Defines whether the standard HTML tags and attributes are shown
111
+ */
112
+ readonly useDefaultDataProvider?: boolean;
113
+ /**
114
+ * Provides a set of custom data providers.
115
+ */
116
+ readonly dataProviders?: {
117
+ [providerId: string]: HTMLDataV1;
118
+ };
119
+ }
120
+ /**
121
+ * Custom HTML tags attributes and attribute values
122
+ * https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md
123
+ */
124
+ interface HTMLDataV1 {
125
+ readonly version: 1 | 1.1;
126
+ readonly tags?: ITagData[];
127
+ readonly globalAttributes?: IAttributeData[];
128
+ readonly valueSets?: IValueSet[];
129
+ }
130
+ interface IReference {
131
+ readonly name: string;
132
+ readonly url: string;
133
+ }
134
+ interface ITagData {
135
+ readonly name: string;
136
+ readonly description?: string | MarkupContent;
137
+ readonly attributes: IAttributeData[];
138
+ readonly references?: IReference[];
139
+ }
140
+ interface IAttributeData {
141
+ readonly name: string;
142
+ readonly description?: string | MarkupContent;
143
+ readonly valueSet?: string;
144
+ readonly values?: IValueData[];
145
+ readonly references?: IReference[];
146
+ }
147
+ interface IValueData {
148
+ readonly name: string;
149
+ readonly description?: string | MarkupContent;
150
+ readonly references?: IReference[];
151
+ }
152
+ interface IValueSet {
153
+ readonly name: string;
154
+ readonly values: IValueData[];
155
+ }
156
+ interface MarkupContent {
157
+ readonly kind: MarkupKind;
158
+ readonly value: string;
159
+ }
160
+ declare type MarkupKind = "plaintext" | "markdown";
161
+ export { handlebarDefaults, handlebarLanguageService, htmlDefaults, htmlLanguageService, razorDefaults, razorLanguageService, registerHTMLLanguageService };
162
+ export type { CompletionConfiguration, HTMLDataConfiguration, HTMLDataV1, HTMLFormatConfiguration, IAttributeData, IReference, ITagData, IValueData, IValueSet, LanguageServiceDefaults, LanguageServiceRegistration, MarkupContent, MarkupKind, ModeConfiguration, Options };
@@ -1,3 +1,4 @@
1
+
1
2
  import { languages, Emitter } from 'monaco-editor';
2
3
 
3
4
  class LanguageServiceDefaultsImpl {
@@ -88,7 +89,7 @@ const razorLanguageService = registerHTMLLanguageService(
88
89
  );
89
90
  const razorDefaults = razorLanguageService.defaults;
90
91
  function getMode() {
91
- return import('./language/html/htmlMode.js');
92
+ return import('./htmlMode.js');
92
93
  }
93
94
  function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
94
95
  const defaults = new LanguageServiceDefaultsImpl(languageId, options, modeConfiguration);
@@ -37,7 +37,7 @@ class WorkerManager {
37
37
  this._worker = createWebWorker({
38
38
  // module that exports the create() method and returns a `HTMLWorker` instance
39
39
  moduleId: "vs/language/html/htmlWorker",
40
- createWorker: () => new Worker(new URL(new URL('../../html.worker.js', import.meta.url).href, import.meta.url), { type: "module" }),
40
+ createWorker: () => new Worker('./html.worker.js', { type: "module" }),
41
41
  // passed in to the create() method
42
42
  createData: {
43
43
  languageSettings: this._defaults.options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-standalone-html-language-features",
3
- "version": "23.2.0",
3
+ "version": "23.2.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -16,16 +16,16 @@
16
16
  "description": "monaco-editor html language features bundled to work with @codingame/monaco-vscode-api",
17
17
  "exports": {
18
18
  ".": {
19
- "default": "./index.js"
19
+ "default": "./language/html/monaco.contribution.js"
20
20
  },
21
21
  "./worker": {
22
- "default": "./worker.js"
22
+ "default": "./language/html/html.worker.js"
23
23
  }
24
24
  },
25
25
  "main": "index.js",
26
26
  "module": "index.js",
27
27
  "dependencies": {
28
- "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@23.2.0",
28
+ "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@23.2.1",
29
29
  "vscode-html-languageservice": "5.2.0",
30
30
  "vscode-languageserver-textdocument": "1.0.12",
31
31
  "vscode-languageserver-types": "3.17.5"
package/worker.js DELETED
@@ -1,8 +0,0 @@
1
- import { initialize } from './common/initialize.js';
2
- import { HTMLWorker } from './language/html/htmlWorker.js';
3
-
4
- self.onmessage = () => {
5
- initialize((ctx, createData) => {
6
- return new HTMLWorker(ctx, createData);
7
- });
8
- };