MCPcopy
hub / github.com/Doorman11991/smallcode / start

Method start

src/lsp/client.js:79–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77 }
78
79 async start() {
80 const server = detectServer(this.cwd);
81 if (!server) return false;
82
83 this.serverInfo = server;
84
85 try {
86 this.process = spawn(server.cmd, server.args, {
87 cwd: this.cwd,
88 stdio: ['pipe', 'pipe', 'pipe'],
89 });
90 } catch {
91 return false;
92 }
93
94 this.process.stdout.on('data', (data) => this._onData(data.toString()));
95 this.process.stderr.on('data', () => {}); // Suppress stderr
96 this.process.on('error', () => { this.process = null; });
97 this.process.on('exit', () => { this.process = null; });
98
99 // Initialize
100 try {
101 await this._request('initialize', {
102 processId: process.pid,
103 capabilities: { textDocument: { publishDiagnostics: {} } },
104 rootUri: `file://${this.cwd.replace(/\\/g, '/')}`,
105 workspaceFolders: [{ uri: `file://${this.cwd.replace(/\\/g, '/')}`, name: path.basename(this.cwd) }],
106 });
107 this._notify('initialized', {});
108 this.initialized = true;
109 return true;
110 } catch {
111 this.stop();
112 return false;
113 }
114 }
115
116 stop() {
117 if (this.process) {

Callers 2

initLSPFunction · 0.95

Calls 5

_onDataMethod · 0.95
_requestMethod · 0.95
_notifyMethod · 0.95
stopMethod · 0.95
detectServerFunction · 0.85

Tested by

no test coverage detected