@coze-editor/code-language-typescript 0.1.0-alpha.0fd19e

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,64 @@
1
+ import * as _codemirror_state from '@codemirror/state';
2
+ import { EditorState, TransactionSpec } from '@codemirror/state';
3
+ import * as _codemirror_language from '@codemirror/language';
4
+ export { typescriptLanguage } from '@codemirror/lang-javascript';
5
+ import * as mitt from 'mitt';
6
+ import { CompletionItem, SignatureHelp } from 'vscode-languageserver-types';
7
+ import { CompilerOptions, FormatCodeSettings } from 'typescript';
8
+ import { LanguageService, Diagnostic } from '@coze-editor/code-language-shared';
9
+
10
+ interface InitializeOptions {
11
+ compilerOptions?: CompilerOptions;
12
+ initialFiles?: Record<string, string>;
13
+ }
14
+
15
+ type Severity = 'hint' | 'info' | 'warning' | 'error';
16
+ type Events = {
17
+ diagnostics: {
18
+ uri: string;
19
+ diagnostics: {
20
+ from: number;
21
+ to: number;
22
+ message: string;
23
+ severity: Severity;
24
+ }[];
25
+ };
26
+ 'refresh-diagnostics': void;
27
+ };
28
+ declare class TypeScriptLanguageService implements LanguageService {
29
+ private worker;
30
+ private starting;
31
+ private _cachedFiles;
32
+ events: mitt.Emitter<Events>;
33
+ private synchronize;
34
+ onTextDocumentDidChange: (ctx: any) => void;
35
+ doHover: NonNullable<LanguageService['doHover']>;
36
+ synchronizeByURI(uri: string, content: string): Promise<void>;
37
+ validateByURI(uri: string): Promise<Diagnostic[]>;
38
+ doValidation: NonNullable<LanguageService['doValidation']>;
39
+ doComplete: LanguageService['doComplete'];
40
+ resolveCompletionItem(ctx: any, item: CompletionItem): Promise<CompletionItem>;
41
+ format(state: EditorState, options?: FormatCodeSettings): Promise<TransactionSpec>;
42
+ getTypeInformation(ctx: any): Promise<{
43
+ type: string;
44
+ properties: {
45
+ name: string;
46
+ type: string;
47
+ }[];
48
+ }>;
49
+ doSignatureHelp(ctx: any): Promise<SignatureHelp>;
50
+ initialize(tsWorker: Worker, options?: InitializeOptions): void;
51
+ private extraFiles;
52
+ addExtraFiles(files: Record<string, string>): Promise<void>;
53
+ }
54
+ declare const typescriptLanguageService: TypeScriptLanguageService;
55
+
56
+ declare const typescript: {
57
+ language: _codemirror_language.LRLanguage;
58
+ languageService: TypeScriptLanguageService;
59
+ extensions: ({
60
+ extension: _codemirror_state.Extension;
61
+ } | readonly _codemirror_state.Extension[] | _codemirror_state.StateField<boolean>)[][];
62
+ };
63
+
64
+ export { TypeScriptLanguageService, typescript, typescriptLanguageService };
@@ -0,0 +1,64 @@
1
+ import * as _codemirror_state from '@codemirror/state';
2
+ import { EditorState, TransactionSpec } from '@codemirror/state';
3
+ import * as _codemirror_language from '@codemirror/language';
4
+ export { typescriptLanguage } from '@codemirror/lang-javascript';
5
+ import * as mitt from 'mitt';
6
+ import { CompletionItem, SignatureHelp } from 'vscode-languageserver-types';
7
+ import { CompilerOptions, FormatCodeSettings } from 'typescript';
8
+ import { LanguageService, Diagnostic } from '@coze-editor/code-language-shared';
9
+
10
+ interface InitializeOptions {
11
+ compilerOptions?: CompilerOptions;
12
+ initialFiles?: Record<string, string>;
13
+ }
14
+
15
+ type Severity = 'hint' | 'info' | 'warning' | 'error';
16
+ type Events = {
17
+ diagnostics: {
18
+ uri: string;
19
+ diagnostics: {
20
+ from: number;
21
+ to: number;
22
+ message: string;
23
+ severity: Severity;
24
+ }[];
25
+ };
26
+ 'refresh-diagnostics': void;
27
+ };
28
+ declare class TypeScriptLanguageService implements LanguageService {
29
+ private worker;
30
+ private starting;
31
+ private _cachedFiles;
32
+ events: mitt.Emitter<Events>;
33
+ private synchronize;
34
+ onTextDocumentDidChange: (ctx: any) => void;
35
+ doHover: NonNullable<LanguageService['doHover']>;
36
+ synchronizeByURI(uri: string, content: string): Promise<void>;
37
+ validateByURI(uri: string): Promise<Diagnostic[]>;
38
+ doValidation: NonNullable<LanguageService['doValidation']>;
39
+ doComplete: LanguageService['doComplete'];
40
+ resolveCompletionItem(ctx: any, item: CompletionItem): Promise<CompletionItem>;
41
+ format(state: EditorState, options?: FormatCodeSettings): Promise<TransactionSpec>;
42
+ getTypeInformation(ctx: any): Promise<{
43
+ type: string;
44
+ properties: {
45
+ name: string;
46
+ type: string;
47
+ }[];
48
+ }>;
49
+ doSignatureHelp(ctx: any): Promise<SignatureHelp>;
50
+ initialize(tsWorker: Worker, options?: InitializeOptions): void;
51
+ private extraFiles;
52
+ addExtraFiles(files: Record<string, string>): Promise<void>;
53
+ }
54
+ declare const typescriptLanguageService: TypeScriptLanguageService;
55
+
56
+ declare const typescript: {
57
+ language: _codemirror_language.LRLanguage;
58
+ languageService: TypeScriptLanguageService;
59
+ extensions: ({
60
+ extension: _codemirror_state.Extension;
61
+ } | readonly _codemirror_state.Extension[] | _codemirror_state.StateField<boolean>)[][];
62
+ };
63
+
64
+ export { TypeScriptLanguageService, typescript, typescriptLanguageService };