driftdetect-lsp 0.9.26 → 0.9.28
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/LICENSE +121 -0
- package/package.json +15 -15
- package/dist/bin/server.d.ts +0 -12
- package/dist/bin/server.js +0 -26
- package/dist/bin/server.js.map +0 -1
- package/dist/capabilities.d.ts +0 -91
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/capabilities.js +0 -183
- package/dist/capabilities.js.map +0 -1
- package/dist/commands/approve-pattern.d.ts +0 -15
- package/dist/commands/approve-pattern.js +0 -83
- package/dist/commands/approve-pattern.js.map +0 -1
- package/dist/commands/create-variant.d.ts +0 -22
- package/dist/commands/create-variant.js +0 -109
- package/dist/commands/create-variant.js.map +0 -1
- package/dist/commands/explain-ai.d.ts +0 -11
- package/dist/commands/explain-ai.js +0 -144
- package/dist/commands/explain-ai.js.map +0 -1
- package/dist/commands/fix-ai.d.ts +0 -11
- package/dist/commands/fix-ai.js +0 -146
- package/dist/commands/fix-ai.js.map +0 -1
- package/dist/commands/ignore-once.d.ts +0 -33
- package/dist/commands/ignore-once.js +0 -147
- package/dist/commands/ignore-once.js.map +0 -1
- package/dist/commands/ignore-pattern.d.ts +0 -15
- package/dist/commands/ignore-pattern.js +0 -77
- package/dist/commands/ignore-pattern.js.map +0 -1
- package/dist/commands/index.d.ts +0 -14
- package/dist/commands/index.js +0 -14
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/rescan.d.ts +0 -19
- package/dist/commands/rescan.js +0 -125
- package/dist/commands/rescan.js.map +0 -1
- package/dist/commands/show-patterns.d.ts +0 -30
- package/dist/commands/show-patterns.js +0 -175
- package/dist/commands/show-patterns.js.map +0 -1
- package/dist/commands/show-violations.d.ts +0 -11
- package/dist/commands/show-violations.js +0 -259
- package/dist/commands/show-violations.js.map +0 -1
- package/dist/handlers/code-actions.d.ts +0 -32
- package/dist/handlers/code-actions.js +0 -184
- package/dist/handlers/code-actions.js.map +0 -1
- package/dist/handlers/code-lens.d.ts +0 -32
- package/dist/handlers/code-lens.js +0 -162
- package/dist/handlers/code-lens.js.map +0 -1
- package/dist/handlers/commands.d.ts +0 -48
- package/dist/handlers/commands.js +0 -360
- package/dist/handlers/commands.js.map +0 -1
- package/dist/handlers/diagnostics.d.ts +0 -73
- package/dist/handlers/diagnostics.js +0 -259
- package/dist/handlers/diagnostics.js.map +0 -1
- package/dist/handlers/document-sync.d.ts +0 -37
- package/dist/handlers/document-sync.js +0 -49
- package/dist/handlers/document-sync.js.map +0 -1
- package/dist/handlers/hover.d.ts +0 -30
- package/dist/handlers/hover.js +0 -119
- package/dist/handlers/hover.js.map +0 -1
- package/dist/handlers/index.d.ts +0 -23
- package/dist/handlers/index.js +0 -16
- package/dist/handlers/index.js.map +0 -1
- package/dist/handlers/initialize.d.ts +0 -41
- package/dist/handlers/initialize.d.ts.map +0 -1
- package/dist/handlers/initialize.js +0 -33
- package/dist/handlers/initialize.js.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/integration/core-scanner.d.ts +0 -89
- package/dist/integration/core-scanner.js +0 -309
- package/dist/integration/core-scanner.js.map +0 -1
- package/dist/integration/index.d.ts +0 -11
- package/dist/integration/index.js +0 -11
- package/dist/integration/index.js.map +0 -1
- package/dist/integration/pattern-store-adapter.d.ts +0 -117
- package/dist/integration/pattern-store-adapter.js +0 -349
- package/dist/integration/pattern-store-adapter.js.map +0 -1
- package/dist/integration/types.d.ts +0 -134
- package/dist/integration/types.js +0 -39
- package/dist/integration/types.js.map +0 -1
- package/dist/server/index.d.ts +0 -5
- package/dist/server/index.js +0 -5
- package/dist/server/index.js.map +0 -1
- package/dist/server/types.d.ts +0 -139
- package/dist/server/types.js +0 -8
- package/dist/server/types.js.map +0 -1
- package/dist/server.d.ts +0 -63
- package/dist/server.js +0 -208
- package/dist/server.js.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js +0 -5
- package/dist/types/index.js.map +0 -1
- package/dist/types/lsp-types.d.ts +0 -321
- package/dist/types/lsp-types.js +0 -274
- package/dist/types/lsp-types.js.map +0 -1
- package/dist/utils/diagnostic.d.ts +0 -84
- package/dist/utils/diagnostic.js +0 -256
- package/dist/utils/diagnostic.js.map +0 -1
- package/dist/utils/document.d.ts +0 -40
- package/dist/utils/document.d.ts.map +0 -1
- package/dist/utils/document.js +0 -138
- package/dist/utils/document.js.map +0 -1
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -8
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/position.d.ts +0 -44
- package/dist/utils/position.d.ts.map +0 -1
- package/dist/utils/position.js +0 -96
- package/dist/utils/position.js.map +0 -1
- package/dist/utils/workspace.d.ts +0 -98
- package/dist/utils/workspace.js +0 -241
- package/dist/utils/workspace.js.map +0 -1
package/dist/server/types.d.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server Types - Core types for the LSP server
|
|
3
|
-
*
|
|
4
|
-
* These types define the server context, state, and interfaces
|
|
5
|
-
* used throughout the LSP implementation.
|
|
6
|
-
*/
|
|
7
|
-
import type { Connection, TextDocuments } from 'vscode-languageserver';
|
|
8
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
9
|
-
import type { DriftDiagnostic, ServerState, ServerConfiguration, PatternInfo, ViolationInfo, DocumentState } from '../types/lsp-types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Logger interface for server logging
|
|
12
|
-
*/
|
|
13
|
-
export interface Logger {
|
|
14
|
-
error(message: string): void;
|
|
15
|
-
warn(message: string): void;
|
|
16
|
-
info(message: string): void;
|
|
17
|
-
debug(message: string): void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Server context passed to handlers and commands
|
|
21
|
-
*/
|
|
22
|
-
export interface ServerContext {
|
|
23
|
-
/** LSP connection */
|
|
24
|
-
connection: Connection;
|
|
25
|
-
/** Document manager */
|
|
26
|
-
documents: TextDocuments<TextDocument>;
|
|
27
|
-
/** Server state */
|
|
28
|
-
state: ServerState;
|
|
29
|
-
/** Logger instance */
|
|
30
|
-
logger: Logger;
|
|
31
|
-
/** Server configuration */
|
|
32
|
-
configuration: ServerConfiguration;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Document scanner interface for scanning documents for violations
|
|
36
|
-
*/
|
|
37
|
-
export interface DocumentScanner {
|
|
38
|
-
/** Scan a document for violations */
|
|
39
|
-
scan(uri: string): Promise<ViolationInfo[]>;
|
|
40
|
-
/** Invalidate cache for a document */
|
|
41
|
-
invalidate(uri: string): void;
|
|
42
|
-
/** Clear all cached scan results */
|
|
43
|
-
clearCache(): void;
|
|
44
|
-
/** Check if a document is cached */
|
|
45
|
-
isCached(uri: string): boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Diagnostic publisher interface for publishing diagnostics
|
|
49
|
-
*/
|
|
50
|
-
export interface DiagnosticPublisher {
|
|
51
|
-
/** Publish diagnostics for a document */
|
|
52
|
-
publish(uri: string): Promise<void>;
|
|
53
|
-
/** Clear diagnostics for a document */
|
|
54
|
-
clear(uri: string): void;
|
|
55
|
-
/** Clear all diagnostics */
|
|
56
|
-
clearAll(): void;
|
|
57
|
-
/** Get diagnostics for a document */
|
|
58
|
-
get(uri: string): DriftDiagnostic[];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Pattern store interface for managing patterns
|
|
62
|
-
*/
|
|
63
|
-
export interface PatternStore {
|
|
64
|
-
/** Get a pattern by ID */
|
|
65
|
-
get(patternId: string): PatternInfo | undefined;
|
|
66
|
-
/** Get all patterns */
|
|
67
|
-
getAll(): PatternInfo[];
|
|
68
|
-
/** Add or update a pattern */
|
|
69
|
-
set(pattern: PatternInfo): void;
|
|
70
|
-
/** Remove a pattern */
|
|
71
|
-
delete(patternId: string): boolean;
|
|
72
|
-
/** Check if a pattern exists */
|
|
73
|
-
has(patternId: string): boolean;
|
|
74
|
-
/** Get patterns by category */
|
|
75
|
-
getByCategory(category: string): PatternInfo[];
|
|
76
|
-
/** Approve a pattern */
|
|
77
|
-
approve(patternId: string): Promise<void>;
|
|
78
|
-
/** Ignore a pattern */
|
|
79
|
-
ignore(patternId: string): Promise<void>;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Violation store interface for managing violations
|
|
83
|
-
*/
|
|
84
|
-
export interface ViolationStore {
|
|
85
|
-
/** Get violations for a document */
|
|
86
|
-
get(uri: string): ViolationInfo[];
|
|
87
|
-
/** Set violations for a document */
|
|
88
|
-
set(uri: string, violations: ViolationInfo[]): void;
|
|
89
|
-
/** Add a violation */
|
|
90
|
-
add(uri: string, violation: ViolationInfo): void;
|
|
91
|
-
/** Remove a violation */
|
|
92
|
-
remove(uri: string, violationId: string): boolean;
|
|
93
|
-
/** Clear violations for a document */
|
|
94
|
-
clear(uri: string): void;
|
|
95
|
-
/** Clear all violations */
|
|
96
|
-
clearAll(): void;
|
|
97
|
-
/** Get all violations */
|
|
98
|
-
getAll(): Map<string, ViolationInfo[]>;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Initialize handler interface
|
|
102
|
-
*/
|
|
103
|
-
export interface InitializeHandler {
|
|
104
|
-
onInitialize(): void;
|
|
105
|
-
onInitialized(): void;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Document sync handler interface
|
|
109
|
-
*/
|
|
110
|
-
export interface DocumentSyncHandler {
|
|
111
|
-
onDidOpen(document: TextDocument): void;
|
|
112
|
-
onDidChangeContent(document: TextDocument): void;
|
|
113
|
-
onDidSave(document: TextDocument): void;
|
|
114
|
-
onDidClose(document: TextDocument): void;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Diagnostics handler interface
|
|
118
|
-
*/
|
|
119
|
-
export interface DiagnosticsHandler {
|
|
120
|
-
publishDiagnostics(uri: string): Promise<void>;
|
|
121
|
-
clearDiagnostics(uri: string): void;
|
|
122
|
-
clearAllDiagnostics(): void;
|
|
123
|
-
getDiagnostics(uri: string): DriftDiagnostic[];
|
|
124
|
-
getDiagnosticAtPosition(uri: string, line: number, character: number): DriftDiagnostic | undefined;
|
|
125
|
-
getViolations(uri: string): ViolationInfo[];
|
|
126
|
-
scheduleUpdate(uri: string, delayMs?: number): void;
|
|
127
|
-
cancelUpdate(uri: string): void;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Result of executing a command
|
|
131
|
-
*/
|
|
132
|
-
export interface CommandResult {
|
|
133
|
-
success: boolean;
|
|
134
|
-
message?: string;
|
|
135
|
-
data?: unknown;
|
|
136
|
-
error?: string;
|
|
137
|
-
}
|
|
138
|
-
export type { DriftDiagnostic, ServerState, ServerConfiguration, PatternInfo, ViolationInfo, DocumentState, };
|
|
139
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/server/types.js
DELETED
package/dist/server/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/server.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drift LSP Server
|
|
3
|
-
*
|
|
4
|
-
* Main entry point for the Language Server Protocol implementation.
|
|
5
|
-
* Creates and manages the LSP connection, registers handlers, and
|
|
6
|
-
* coordinates between the editor and Drift core engine.
|
|
7
|
-
*
|
|
8
|
-
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
9
|
-
* @requirements 27.7 - THE LSP_Server SHALL respond to diagnostics within 200ms of file change
|
|
10
|
-
*/
|
|
11
|
-
import { TextDocuments } from 'vscode-languageserver/node.js';
|
|
12
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
13
|
-
import type { Connection } from 'vscode-languageserver';
|
|
14
|
-
/**
|
|
15
|
-
* Server configuration options
|
|
16
|
-
*/
|
|
17
|
-
export interface ServerOptions {
|
|
18
|
-
/** Workspace root path */
|
|
19
|
-
workspaceRoot?: string;
|
|
20
|
-
/** Enable debug logging */
|
|
21
|
-
debug?: boolean;
|
|
22
|
-
/** Custom connection (for testing) */
|
|
23
|
-
connection?: Connection;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Server state
|
|
27
|
-
*/
|
|
28
|
-
export interface ServerState {
|
|
29
|
-
/** Whether server has been initialized */
|
|
30
|
-
initialized: boolean;
|
|
31
|
-
/** Workspace folders */
|
|
32
|
-
workspaceFolders: Array<{
|
|
33
|
-
uri: string;
|
|
34
|
-
name: string;
|
|
35
|
-
}>;
|
|
36
|
-
/** Client capabilities */
|
|
37
|
-
hasConfigurationCapability: boolean;
|
|
38
|
-
hasWorkspaceFolderCapability: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Drift LSP Server interface
|
|
42
|
-
*/
|
|
43
|
-
export interface DriftServer {
|
|
44
|
-
/** Start the server */
|
|
45
|
-
start(): void;
|
|
46
|
-
/** Stop the server */
|
|
47
|
-
stop(): void;
|
|
48
|
-
/** Get the LSP connection */
|
|
49
|
-
getConnection(): Connection;
|
|
50
|
-
/** Get the document manager */
|
|
51
|
-
getDocuments(): TextDocuments<TextDocument>;
|
|
52
|
-
/** Check if server is running */
|
|
53
|
-
isRunning(): boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Create a new Drift LSP server instance
|
|
57
|
-
*/
|
|
58
|
-
export declare function createDriftServer(options?: ServerOptions): DriftServer;
|
|
59
|
-
/**
|
|
60
|
-
* Create and start a Drift LSP server
|
|
61
|
-
*/
|
|
62
|
-
export declare function startDriftServer(options?: ServerOptions): DriftServer;
|
|
63
|
-
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drift LSP Server
|
|
3
|
-
*
|
|
4
|
-
* Main entry point for the Language Server Protocol implementation.
|
|
5
|
-
* Creates and manages the LSP connection, registers handlers, and
|
|
6
|
-
* coordinates between the editor and Drift core engine.
|
|
7
|
-
*
|
|
8
|
-
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
9
|
-
* @requirements 27.7 - THE LSP_Server SHALL respond to diagnostics within 200ms of file change
|
|
10
|
-
*/
|
|
11
|
-
import { createConnection, ProposedFeatures, TextDocuments, DidChangeConfigurationNotification, } from 'vscode-languageserver/node.js';
|
|
12
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
13
|
-
import { buildInitializeResult, clientSupportsConfiguration, clientSupportsWorkspaceFolders } from './capabilities.js';
|
|
14
|
-
import { createInitializeHandler } from './handlers/initialize.js';
|
|
15
|
-
import { createDocumentSyncHandler } from './handlers/document-sync.js';
|
|
16
|
-
import { createDiagnosticsHandler } from './handlers/diagnostics.js';
|
|
17
|
-
import { createCodeActionsHandler } from './handlers/code-actions.js';
|
|
18
|
-
import { createHoverHandler } from './handlers/hover.js';
|
|
19
|
-
import { createCodeLensHandler } from './handlers/code-lens.js';
|
|
20
|
-
import { createCommandsHandler } from './handlers/commands.js';
|
|
21
|
-
function createLogger(connection, debug) {
|
|
22
|
-
return {
|
|
23
|
-
error: (msg) => connection.console.error(`[drift-lsp] ${msg}`),
|
|
24
|
-
warn: (msg) => connection.console.warn(`[drift-lsp] ${msg}`),
|
|
25
|
-
info: (msg) => connection.console.info(`[drift-lsp] ${msg}`),
|
|
26
|
-
debug: (msg) => {
|
|
27
|
-
if (debug) {
|
|
28
|
-
connection.console.log(`[drift-lsp] DEBUG: ${msg}`);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// Server Factory
|
|
35
|
-
// ============================================================================
|
|
36
|
-
/**
|
|
37
|
-
* Create a new Drift LSP server instance
|
|
38
|
-
*/
|
|
39
|
-
export function createDriftServer(options = {}) {
|
|
40
|
-
// Create connection
|
|
41
|
-
const connection = options.connection ?? createConnection(ProposedFeatures.all);
|
|
42
|
-
// Create document manager
|
|
43
|
-
const documents = new TextDocuments(TextDocument);
|
|
44
|
-
// Create logger
|
|
45
|
-
const logger = createLogger(connection, options.debug ?? false);
|
|
46
|
-
// Server state
|
|
47
|
-
const state = {
|
|
48
|
-
initialized: false,
|
|
49
|
-
workspaceFolders: [],
|
|
50
|
-
hasConfigurationCapability: false,
|
|
51
|
-
hasWorkspaceFolderCapability: false,
|
|
52
|
-
};
|
|
53
|
-
// Track running state
|
|
54
|
-
let isServerRunning = false;
|
|
55
|
-
// Diagnostic timers for debouncing
|
|
56
|
-
const diagnosticTimers = new Map();
|
|
57
|
-
// ============================================================================
|
|
58
|
-
// Initialize Handler
|
|
59
|
-
// ============================================================================
|
|
60
|
-
connection.onInitialize((params) => {
|
|
61
|
-
logger.info('Initializing Drift LSP server...');
|
|
62
|
-
// Check client capabilities
|
|
63
|
-
state.hasConfigurationCapability = clientSupportsConfiguration(params.capabilities);
|
|
64
|
-
state.hasWorkspaceFolderCapability = clientSupportsWorkspaceFolders(params.capabilities);
|
|
65
|
-
// Store workspace folders
|
|
66
|
-
if (params.workspaceFolders) {
|
|
67
|
-
state.workspaceFolders = params.workspaceFolders.map((f) => ({
|
|
68
|
-
uri: f.uri,
|
|
69
|
-
name: f.name,
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
else if (params.rootUri) {
|
|
73
|
-
state.workspaceFolders = [{ uri: params.rootUri, name: 'workspace' }];
|
|
74
|
-
}
|
|
75
|
-
logger.info(`Workspace folders: ${state.workspaceFolders.map((f) => f.name).join(', ')}`);
|
|
76
|
-
return buildInitializeResult();
|
|
77
|
-
});
|
|
78
|
-
connection.onInitialized(() => {
|
|
79
|
-
logger.info('Drift LSP server initialized');
|
|
80
|
-
state.initialized = true;
|
|
81
|
-
// Register for configuration changes
|
|
82
|
-
if (state.hasConfigurationCapability) {
|
|
83
|
-
connection.client.register(DidChangeConfigurationNotification.type, undefined);
|
|
84
|
-
}
|
|
85
|
-
// Register for workspace folder changes
|
|
86
|
-
if (state.hasWorkspaceFolderCapability) {
|
|
87
|
-
connection.workspace.onDidChangeWorkspaceFolders((event) => {
|
|
88
|
-
for (const removed of event.removed) {
|
|
89
|
-
const idx = state.workspaceFolders.findIndex((f) => f.uri === removed.uri);
|
|
90
|
-
if (idx !== -1) {
|
|
91
|
-
state.workspaceFolders.splice(idx, 1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
for (const added of event.added) {
|
|
95
|
-
state.workspaceFolders.push({ uri: added.uri, name: added.name });
|
|
96
|
-
}
|
|
97
|
-
logger.info(`Workspace folders changed: +${event.added.length}, -${event.removed.length}`);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
// ============================================================================
|
|
102
|
-
// Shutdown Handlers
|
|
103
|
-
// ============================================================================
|
|
104
|
-
connection.onShutdown(() => {
|
|
105
|
-
logger.info('Drift LSP server shutting down...');
|
|
106
|
-
state.initialized = false;
|
|
107
|
-
// Clear all diagnostic timers
|
|
108
|
-
for (const timer of diagnosticTimers.values()) {
|
|
109
|
-
clearTimeout(timer);
|
|
110
|
-
}
|
|
111
|
-
diagnosticTimers.clear();
|
|
112
|
-
});
|
|
113
|
-
connection.onExit(() => {
|
|
114
|
-
logger.info('Drift LSP server exiting');
|
|
115
|
-
isServerRunning = false;
|
|
116
|
-
});
|
|
117
|
-
// ============================================================================
|
|
118
|
-
// Create Handlers
|
|
119
|
-
// ============================================================================
|
|
120
|
-
// Note: Initialize handler is created for potential future use but initialization
|
|
121
|
-
// is currently handled inline in connection.onInitialize and connection.onInitialized
|
|
122
|
-
createInitializeHandler(connection, state, logger);
|
|
123
|
-
const diagnosticsHandler = createDiagnosticsHandler(connection, documents, state, logger);
|
|
124
|
-
const documentSyncHandler = createDocumentSyncHandler(connection, documents, diagnosticsHandler, logger);
|
|
125
|
-
const codeActionsHandler = createCodeActionsHandler(connection, documents, diagnosticsHandler, logger);
|
|
126
|
-
const hoverHandler = createHoverHandler(connection, documents, diagnosticsHandler, logger);
|
|
127
|
-
const codeLensHandler = createCodeLensHandler(connection, documents, diagnosticsHandler, logger);
|
|
128
|
-
const commandsHandler = createCommandsHandler(connection, documents, diagnosticsHandler, logger);
|
|
129
|
-
// ============================================================================
|
|
130
|
-
// Register Handlers
|
|
131
|
-
// ============================================================================
|
|
132
|
-
function registerHandlers() {
|
|
133
|
-
logger.debug('Registering LSP handlers...');
|
|
134
|
-
// Document sync events
|
|
135
|
-
documents.onDidChangeContent((event) => {
|
|
136
|
-
documentSyncHandler.onDidChangeContent(event);
|
|
137
|
-
});
|
|
138
|
-
documents.onDidOpen((event) => {
|
|
139
|
-
documentSyncHandler.onDidOpen(event.document);
|
|
140
|
-
});
|
|
141
|
-
documents.onDidSave((event) => {
|
|
142
|
-
documentSyncHandler.onDidSave(event.document);
|
|
143
|
-
});
|
|
144
|
-
documents.onDidClose((event) => {
|
|
145
|
-
documentSyncHandler.onDidClose(event.document);
|
|
146
|
-
});
|
|
147
|
-
// Code actions
|
|
148
|
-
connection.onCodeAction(codeActionsHandler.onCodeAction);
|
|
149
|
-
connection.onCodeActionResolve(codeActionsHandler.onCodeActionResolve);
|
|
150
|
-
// Hover
|
|
151
|
-
connection.onHover(hoverHandler.onHover);
|
|
152
|
-
// Code lens
|
|
153
|
-
connection.onCodeLens(codeLensHandler.onCodeLens);
|
|
154
|
-
connection.onCodeLensResolve(codeLensHandler.onCodeLensResolve);
|
|
155
|
-
// Commands
|
|
156
|
-
connection.onExecuteCommand(commandsHandler.onExecuteCommand);
|
|
157
|
-
// Start listening on documents
|
|
158
|
-
documents.listen(connection);
|
|
159
|
-
logger.debug('LSP handlers registered');
|
|
160
|
-
}
|
|
161
|
-
// ============================================================================
|
|
162
|
-
// Server Interface
|
|
163
|
-
// ============================================================================
|
|
164
|
-
return {
|
|
165
|
-
start() {
|
|
166
|
-
if (isServerRunning) {
|
|
167
|
-
logger.warn('Server already running');
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
logger.info('Starting Drift LSP server...');
|
|
171
|
-
registerHandlers();
|
|
172
|
-
connection.listen();
|
|
173
|
-
isServerRunning = true;
|
|
174
|
-
},
|
|
175
|
-
stop() {
|
|
176
|
-
if (!isServerRunning) {
|
|
177
|
-
logger.warn('Server not running');
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
logger.info('Stopping Drift LSP server...');
|
|
181
|
-
// Clear diagnostic timers
|
|
182
|
-
for (const timer of diagnosticTimers.values()) {
|
|
183
|
-
clearTimeout(timer);
|
|
184
|
-
}
|
|
185
|
-
diagnosticTimers.clear();
|
|
186
|
-
connection.dispose();
|
|
187
|
-
isServerRunning = false;
|
|
188
|
-
},
|
|
189
|
-
getConnection() {
|
|
190
|
-
return connection;
|
|
191
|
-
},
|
|
192
|
-
getDocuments() {
|
|
193
|
-
return documents;
|
|
194
|
-
},
|
|
195
|
-
isRunning() {
|
|
196
|
-
return isServerRunning;
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Create and start a Drift LSP server
|
|
202
|
-
*/
|
|
203
|
-
export function startDriftServer(options = {}) {
|
|
204
|
-
const server = createDriftServer(options);
|
|
205
|
-
server.start();
|
|
206
|
-
return server;
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,kCAAkC,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAQlE,OAAO,EAAE,qBAAqB,EAAE,2B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K,EAAE,CAAC;IACf,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/types/index.d.ts
DELETED
package/dist/types/index.js
DELETED
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,gBAAgB,CAAC"}
|