forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
types.ts
132 lines (122 loc) · 4.9 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { Event } from 'vscode';
import { LanguageClient, LanguageClientOptions } from 'vscode-languageclient/node';
import type { IDisposable, ILogOutputChannel, Resource } from '../common/types';
import { StopWatch } from '../common/utils/stopWatch';
import { PythonEnvironment } from '../pythonEnvironments/info';
export const IExtensionActivationManager = Symbol('IExtensionActivationManager');
/**
* Responsible for activation of extension.
*
* @export
* @interface IExtensionActivationManager
* @extends {IDisposable}
*/
export interface IExtensionActivationManager extends IDisposable {
/**
* Method invoked when extension activates (invoked once).
*
* @returns {Promise<void>}
* @memberof IExtensionActivationManager
*/
activate(startupStopWatch: StopWatch): Promise<void>;
/**
* Method invoked when a workspace is loaded.
* This is where we place initialization scripts for each workspace.
* (e.g. if we need to run code for each workspace, then this is where that happens).
*
* @param {Resource} resource
* @returns {Promise<void>}
* @memberof IExtensionActivationManager
*/
activateWorkspace(resource: Resource): Promise<void>;
}
export const IExtensionActivationService = Symbol('IExtensionActivationService');
/**
* Classes implementing this interface will have their `activate` methods
* invoked for every workspace folder (in multi-root workspace folders) during the activation of the extension.
* This is a great hook for extension activation code, i.e. you don't need to modify
* the `extension.ts` file to invoke some code when extension gets activated.
* @export
* @interface IExtensionActivationService
*/
export interface IExtensionActivationService {
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean };
activate(resource: Resource, startupStopWatch?: StopWatch): Promise<void>;
}
export enum LanguageServerType {
Jedi = 'Jedi',
JediLSP = 'JediLSP',
Microsoft = 'Microsoft',
Node = 'Pylance',
None = 'None',
}
export const ILanguageServerActivator = Symbol('ILanguageServerActivator');
export interface ILanguageServerActivator {
start(resource: Resource, interpreter: PythonEnvironment | undefined): Promise<void>;
activate(): void;
deactivate(): void;
}
export const ILanguageClientFactory = Symbol('ILanguageClientFactory');
export interface ILanguageClientFactory {
createLanguageClient(
resource: Resource,
interpreter: PythonEnvironment | undefined,
clientOptions: LanguageClientOptions,
env?: NodeJS.ProcessEnv,
): Promise<LanguageClient>;
}
export const ILanguageServerAnalysisOptions = Symbol('ILanguageServerAnalysisOptions');
export interface ILanguageServerAnalysisOptions extends IDisposable {
readonly onDidChange: Event<void>;
initialize(resource: Resource, interpreter: PythonEnvironment | undefined): Promise<void>;
getAnalysisOptions(): Promise<LanguageClientOptions>;
}
export const ILanguageServerManager = Symbol('ILanguageServerManager');
export interface ILanguageServerManager extends IDisposable {
start(resource: Resource, interpreter: PythonEnvironment | undefined): Promise<void>;
connect(): void;
disconnect(): void;
}
export const ILanguageServerProxy = Symbol('ILanguageServerProxy');
export interface ILanguageServerProxy extends IDisposable {
start(
resource: Resource,
interpreter: PythonEnvironment | undefined,
options: LanguageClientOptions,
): Promise<void>;
stop(): Promise<void>;
/**
* Sends a request to LS so as to load other extensions.
* This is used as a plugin loader mechanism.
* Anyone (such as intellicode) wanting to interact with LS, needs to send this request to LS.
* @param {{}} [args]
* @memberof ILanguageServerProxy
*/
loadExtension(args?: unknown): void;
}
export const ILanguageServerOutputChannel = Symbol('ILanguageServerOutputChannel');
export interface ILanguageServerOutputChannel {
/**
* Creates output channel if necessary and returns it
*
* @type {ILogOutputChannel}
* @memberof ILanguageServerOutputChannel
*/
readonly channel: ILogOutputChannel;
}
export const IExtensionSingleActivationService = Symbol('IExtensionSingleActivationService');
/**
* Classes implementing this interface will have their `activate` methods
* invoked during the activation of the extension.
* This is a great hook for extension activation code, i.e. you don't need to modify
* the `extension.ts` file to invoke some code when extension gets activated.
* @export
* @interface IExtensionSingleActivationService
*/
export interface IExtensionSingleActivationService {
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean };
activate(): Promise<void>;
}