@ -18,7 +18,6 @@ import { LanguageSupport } from '@codemirror/language'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { paths } from 'lib/paths'
|
||||
import { FileEntry } from 'lib/types'
|
||||
import Worker from 'editor/plugins/lsp/worker.ts?worker'
|
||||
import {
|
||||
KclWorkerOptions,
|
||||
CopilotWorkerOptions,
|
||||
@ -28,7 +27,6 @@ import { wasmUrl } from 'lang/wasm'
|
||||
import { PROJECT_ENTRYPOINT } from 'lib/constants'
|
||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||
import { err } from 'lib/trap'
|
||||
|
||||
function getWorkspaceFolders(): LSP.WorkspaceFolder[] {
|
||||
return []
|
||||
|
||||
@ -11,19 +11,13 @@ import {
|
||||
} from 'editor/plugins/lsp/types'
|
||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import { err } from 'lib/trap'
|
||||
import {
|
||||
WriteableStreamMessageWriter,
|
||||
ReadableStreamMessageReader,
|
||||
Message,
|
||||
} from 'vscode-languageclient'
|
||||
import { Message } from 'vscode-languageserver'
|
||||
import { LspWorkerEvent, LspWorkerEventType } from 'editor/plugins/lsp/types'
|
||||
import { WritableStreamImpl } from 'editor/plugins/lsp/writer'
|
||||
import Queue from 'editor/plugins/lsp/queue'
|
||||
import {
|
||||
BrowserMessageReader,
|
||||
BrowserMessageWriter,
|
||||
} from 'vscode-languageserver-protocol/browser'
|
||||
import * as jsrpc from 'json-rpc-2.0'
|
||||
|
||||
class Headers {
|
||||
static add(message: string): string {
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
import { Disposable, Emitter, Event, Message, RAL } from 'vscode-languageclient'
|
||||
|
||||
/**
|
||||
* A writable stream.
|
||||
*
|
||||
* This interface is not intended to be implemented. Instances of this
|
||||
* interface are available via `Wasm.createWritable`.
|
||||
*/
|
||||
interface Writable {
|
||||
/**
|
||||
* Write some data to the stream.
|
||||
* @param chunk The data to write.
|
||||
*/
|
||||
write(chunk: Uint8Array): Promise<void>
|
||||
|
||||
/**
|
||||
* Write a string to the stream.
|
||||
* @param chunk The string to write.
|
||||
* @param encoding The encoding to use to convert to a binary format.
|
||||
*/
|
||||
write(chunk: string, encoding?: 'utf-8'): Promise<void>
|
||||
}
|
||||
|
||||
export class WritableStreamImpl implements RAL.WritableStream {
|
||||
private readonly errorEmitter: Emitter<
|
||||
[Error, Message | undefined, number | undefined]
|
||||
>
|
||||
private readonly closeEmitter: Emitter<void>
|
||||
private readonly endEmitter: Emitter<void>
|
||||
|
||||
private readonly writable: Writable
|
||||
|
||||
constructor(writable: Writable) {
|
||||
this.errorEmitter = new Emitter<[Error, Message, number]>()
|
||||
this.closeEmitter = new Emitter<void>()
|
||||
this.endEmitter = new Emitter<void>()
|
||||
this.writable = writable
|
||||
}
|
||||
|
||||
public get onError(): Event<
|
||||
[Error, Message | undefined, number | undefined]
|
||||
> {
|
||||
return this.errorEmitter.event
|
||||
}
|
||||
|
||||
public fireError(error: any, message?: Message, count?: number): void {
|
||||
this.errorEmitter.fire([error, message, count])
|
||||
}
|
||||
|
||||
public get onClose(): Event<void> {
|
||||
return this.closeEmitter.event
|
||||
}
|
||||
|
||||
public fireClose(): void {
|
||||
this.closeEmitter.fire(undefined)
|
||||
}
|
||||
|
||||
public onEnd(listener: () => void): Disposable {
|
||||
return this.endEmitter.event(listener)
|
||||
}
|
||||
|
||||
public fireEnd(): void {
|
||||
this.endEmitter.fire(undefined)
|
||||
}
|
||||
|
||||
public write(
|
||||
data: string | Uint8Array,
|
||||
_encoding?: RAL.MessageBufferEncoding
|
||||
): Promise<void> {
|
||||
if (typeof data === 'string') {
|
||||
return this.writable.write(data, 'utf-8')
|
||||
} else {
|
||||
return this.writable.write(data)
|
||||
}
|
||||
}
|
||||
|
||||
public end(): void {}
|
||||
}
|
||||
@ -19,7 +19,6 @@ import {
|
||||
createPipeSubstitution,
|
||||
} from './modifyAst'
|
||||
import { err } from 'lib/trap'
|
||||
import { warn } from 'node:console'
|
||||
|
||||
beforeAll(async () => {
|
||||
await initPromise
|
||||
|
||||
@ -24,11 +24,7 @@ import {
|
||||
isNotLiteralArrayOrStatic,
|
||||
} from 'lang/std/sketchcombos'
|
||||
import { toolTips, ToolTip } from '../../useStore'
|
||||
import {
|
||||
createIdentifier,
|
||||
createPipeExpression,
|
||||
splitPathAtPipeExpression,
|
||||
} from '../modifyAst'
|
||||
import { createPipeExpression, splitPathAtPipeExpression } from '../modifyAst'
|
||||
|
||||
import {
|
||||
SketchLineHelper,
|
||||
|
||||
Reference in New Issue
Block a user