ace-linters 1.8.0 → 1.8.3
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 +35 -0
- package/build/ace-language-client.d.ts +56 -12
- package/build/ace-language-client.js +349 -186
- package/build/ace-linters.d.ts +56 -12
- package/build/ace-linters.js +349 -186
- package/build/base-service.js +4 -2
- package/build/css-service.js +4 -2
- package/build/html-service.js +4 -2
- package/build/javascript-service.js +4 -2
- package/build/json-service.js +4 -2
- package/build/language-client.d.ts +3 -0
- package/build/language-client.js +184 -3
- package/build/lua-service.js +4 -2
- package/build/php-service.js +4 -2
- package/build/typescript-service.js +4 -2
- package/build/xml-service.js +4 -2
- package/build/yaml-service.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,41 @@ languageProvider.registerEditor(editor);
|
|
|
28
28
|
|
|
29
29
|
[Example webworker.js with all services](https://github.com/mkslanc/ace-linters/blob/main/packages/demo/webworker-lsp/webworker.ts)
|
|
30
30
|
|
|
31
|
+
## New features in 1.8.1
|
|
32
|
+
- add `manualSessionControl` provider option to disable automatic session registration. When enabled, you must manually handle session changes:
|
|
33
|
+
```javascript
|
|
34
|
+
// Create provider with manual session control
|
|
35
|
+
let languageProvider = LanguageProvider.create(worker, {
|
|
36
|
+
manualSessionControl: true
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Register sessions manually
|
|
40
|
+
languageProvider.registerSession(editor.session, editor, {
|
|
41
|
+
filePath: 'path/to/file.ts',
|
|
42
|
+
joinWorkspaceURI: true
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Handle session changes manually
|
|
46
|
+
editor.on("changeSession", ({session}) => {
|
|
47
|
+
languageProvider.registerSession(session, editor, session.lspConfig);
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
- add `setSessionLspConfig` method to set LSP configuration on Ace sessions:
|
|
51
|
+
```javascript
|
|
52
|
+
// Set LSP configuration on session
|
|
53
|
+
languageProvider.setSessionLspConfig(editor.session, {
|
|
54
|
+
filePath: 'src/components/MyComponent.tsx',
|
|
55
|
+
joinWorkspaceURI: true
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
- add `setDocumentOptions` method to replace deprecated `setSessionOptions`:
|
|
59
|
+
```javascript
|
|
60
|
+
// Configure document-specific options (replaces setSessionOptions)
|
|
61
|
+
languageProvider.setDocumentOptions(editor.session, {
|
|
62
|
+
// service-specific options here
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
31
66
|
## New Features in 1.2.0
|
|
32
67
|
- add `setProviderOptions` method to `LanguageProvider` to set options for client.
|
|
33
68
|
- add experimental semantic tokens support (turned off by default). To turn on semantic tokens, set `semanticTokens` to
|
|
@@ -596,14 +596,22 @@ export interface ProviderOptions {
|
|
|
596
596
|
"CommandBarTooltip"?: typeof CommandBarTooltip;
|
|
597
597
|
"CompletionProvider"?: typeof CompletionProvider;
|
|
598
598
|
};
|
|
599
|
+
/**
|
|
600
|
+
* When true, disables automatic session registration on editor session changes.
|
|
601
|
+
* Users must manually call registerSession() and handle session change events themselves.
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
manualSessionControl?: boolean;
|
|
599
605
|
}
|
|
600
|
-
export interface
|
|
606
|
+
export interface SessionLspConfig {
|
|
601
607
|
/**
|
|
602
|
-
*
|
|
608
|
+
* Absolute or relative path of the file for the session
|
|
603
609
|
*/
|
|
604
610
|
filePath: string;
|
|
605
611
|
/**
|
|
606
|
-
*
|
|
612
|
+
* When `true` the given path is treated as relative and will be joined with
|
|
613
|
+
* the workspace’s root URI to form the final canonical URI. When false (or omitted) filePath is just transformed to
|
|
614
|
+
* URI.
|
|
607
615
|
* @default `false`
|
|
608
616
|
*/
|
|
609
617
|
joinWorkspaceURI?: boolean;
|
|
@@ -758,7 +766,7 @@ declare class SessionLanguageProvider {
|
|
|
758
766
|
* @param messageController - The `IMessageController` instance for handling messages.
|
|
759
767
|
* @param config
|
|
760
768
|
*/
|
|
761
|
-
constructor(provider: LanguageProvider, session: Ace.EditSession, editor: Ace.Editor, messageController: IMessageController, config?:
|
|
769
|
+
constructor(provider: LanguageProvider, session: Ace.EditSession, editor: Ace.Editor, messageController: IMessageController, config?: SessionLspConfig);
|
|
762
770
|
enqueueIfNotConnected(callback: () => void): void;
|
|
763
771
|
get comboDocumentIdentifier(): ComboDocumentIdentifier;
|
|
764
772
|
/**
|
|
@@ -766,7 +774,9 @@ declare class SessionLanguageProvider {
|
|
|
766
774
|
* Increments the document version and updates the internal document URI and identifier.
|
|
767
775
|
*
|
|
768
776
|
* @param {string} filePath - The new file path for the document.
|
|
769
|
-
* @param {boolean} [joinWorkspaceURI] -
|
|
777
|
+
* @param {boolean} [joinWorkspaceURI] - when true the given path is treated as relative and will be joined with
|
|
778
|
+
* the workspace’s root URI to form the final canonical URI. When false (or omitted) filePath is just transformed to
|
|
779
|
+
* URI.
|
|
770
780
|
*/
|
|
771
781
|
setFilePath(filePath: string, joinWorkspaceURI?: boolean): void;
|
|
772
782
|
private $init;
|
|
@@ -845,8 +855,25 @@ declare class LanguageProvider {
|
|
|
845
855
|
* @param session The Ace edit session to update with the file path.
|
|
846
856
|
* @param config config to set
|
|
847
857
|
*/
|
|
848
|
-
setSessionFilePath(session: Ace.EditSession, config:
|
|
849
|
-
|
|
858
|
+
setSessionFilePath(session: Ace.EditSession, config: SessionLspConfig): void;
|
|
859
|
+
/**
|
|
860
|
+
* Registers a new editing session with the editor and associates it with a language provider.
|
|
861
|
+
* If a language provider for the specified editing session does not already exist, it initializes
|
|
862
|
+
* and stores a new session-specific language provider.
|
|
863
|
+
*
|
|
864
|
+
* @param session - The Ace EditSession object to be registered, representing a specific editing session.
|
|
865
|
+
* @param editor - The Ace Editor instance associated with the editing session.
|
|
866
|
+
* @param [config] - An optional configuration object for initializing the session.
|
|
867
|
+
*/
|
|
868
|
+
registerSession: (session: Ace.EditSession, editor: Ace.Editor, config?: SessionLspConfig) => void;
|
|
869
|
+
/**
|
|
870
|
+
* Sets the Language Server Protocol (LSP) configuration for the given session.
|
|
871
|
+
*
|
|
872
|
+
* @param session - The editor session to which the LSP configuration will be applied.
|
|
873
|
+
* @param config - The LSP configuration to set for the session.
|
|
874
|
+
* @return The updated editor session with the applied LSP configuration.
|
|
875
|
+
*/
|
|
876
|
+
setSessionLspConfig(session: Ace.EditSession, config: SessionLspConfig): import("ace-code").EditSession;
|
|
850
877
|
private $getSessionLanguageProvider;
|
|
851
878
|
private $getFileName;
|
|
852
879
|
/**
|
|
@@ -855,7 +882,7 @@ declare class LanguageProvider {
|
|
|
855
882
|
* @param editor - The Ace editor instance to be registered.
|
|
856
883
|
* @param [config] - Configuration options for the session.
|
|
857
884
|
*/
|
|
858
|
-
registerEditor(editor: Ace.Editor, config?:
|
|
885
|
+
registerEditor(editor: Ace.Editor, config?: SessionLspConfig): void;
|
|
859
886
|
codeActionCallback: (codeActions: CodeActionsByService[]) => void;
|
|
860
887
|
/**
|
|
861
888
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
@@ -872,11 +899,19 @@ declare class LanguageProvider {
|
|
|
872
899
|
private createErrorNode;
|
|
873
900
|
private setStyles;
|
|
874
901
|
/**
|
|
875
|
-
*
|
|
902
|
+
* Configures global options that apply to all documents handled by the specified language service.
|
|
903
|
+
*
|
|
904
|
+
* Global options serve as default settings for all documents processed by a service when no
|
|
905
|
+
* document-specific options are provided. These options affect language service behavior across
|
|
906
|
+
* the entire workspace, including validation rules, formatting preferences, completion settings,
|
|
907
|
+
* and service-specific configurations.
|
|
876
908
|
*
|
|
877
|
-
* @param serviceName - The
|
|
878
|
-
*
|
|
879
|
-
* @param
|
|
909
|
+
* @param serviceName - The identifier of the language service to configure. Must be a valid
|
|
910
|
+
* service name from the supported services (e.g., 'typescript', 'json', 'html').
|
|
911
|
+
* @param options - The global configuration options specific to the language service. The structure
|
|
912
|
+
* varies by service type.
|
|
913
|
+
* @param {boolean} [merge=false] - Indicates whether to merge the provided options with the existing options.
|
|
914
|
+
* Defaults to false.
|
|
880
915
|
*/
|
|
881
916
|
setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T & string, options: ServiceOptionsMap[T], merge?: boolean): void;
|
|
882
917
|
/**
|
|
@@ -895,8 +930,17 @@ declare class LanguageProvider {
|
|
|
895
930
|
*
|
|
896
931
|
* @param session - The Ace editor session to configure.
|
|
897
932
|
* @param options - The configuration options to be applied to the session.
|
|
933
|
+
* @deprecated Use `setDocumentOptions` instead. This method will be removed in the future.
|
|
898
934
|
*/
|
|
899
935
|
setSessionOptions<OptionsType extends ServiceOptions>(session: Ace.EditSession, options: OptionsType): void;
|
|
936
|
+
/**
|
|
937
|
+
* Sets configuration options for a document associated with the specified editor session.
|
|
938
|
+
*
|
|
939
|
+
* @param session - The Ace editor session representing the document to configure.
|
|
940
|
+
* @param options - The service options to apply. The exact shape depends on the language services
|
|
941
|
+
* active for this session (e.g. JSON schema settings).
|
|
942
|
+
*/
|
|
943
|
+
setDocumentOptions<OptionsType extends ServiceOptions>(session: Ace.EditSession, options: OptionsType): void;
|
|
900
944
|
/**
|
|
901
945
|
* Configures the specified features for a given service.
|
|
902
946
|
*
|