@ -18,7 +18,6 @@ import { LanguageSupport } from '@codemirror/language'
|
|||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { paths } from 'lib/paths'
|
import { paths } from 'lib/paths'
|
||||||
import { FileEntry } from 'lib/types'
|
import { FileEntry } from 'lib/types'
|
||||||
import Worker from 'editor/plugins/lsp/worker.ts?worker'
|
|
||||||
import {
|
import {
|
||||||
KclWorkerOptions,
|
KclWorkerOptions,
|
||||||
CopilotWorkerOptions,
|
CopilotWorkerOptions,
|
||||||
@ -28,7 +27,6 @@ import { wasmUrl } from 'lang/wasm'
|
|||||||
import { PROJECT_ENTRYPOINT } from 'lib/constants'
|
import { PROJECT_ENTRYPOINT } from 'lib/constants'
|
||||||
import { useNetworkContext } from 'hooks/useNetworkContext'
|
import { useNetworkContext } from 'hooks/useNetworkContext'
|
||||||
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
||||||
import { err } from 'lib/trap'
|
|
||||||
|
|
||||||
function getWorkspaceFolders(): LSP.WorkspaceFolder[] {
|
function getWorkspaceFolders(): LSP.WorkspaceFolder[] {
|
||||||
return []
|
return []
|
||||||
|
|||||||
@ -11,19 +11,13 @@ import {
|
|||||||
} from 'editor/plugins/lsp/types'
|
} from 'editor/plugins/lsp/types'
|
||||||
import { EngineCommandManager } from 'lang/std/engineConnection'
|
import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import {
|
import { Message } from 'vscode-languageserver'
|
||||||
WriteableStreamMessageWriter,
|
|
||||||
ReadableStreamMessageReader,
|
|
||||||
Message,
|
|
||||||
} from 'vscode-languageclient'
|
|
||||||
import { LspWorkerEvent, LspWorkerEventType } from 'editor/plugins/lsp/types'
|
import { LspWorkerEvent, LspWorkerEventType } from 'editor/plugins/lsp/types'
|
||||||
import { WritableStreamImpl } from 'editor/plugins/lsp/writer'
|
|
||||||
import Queue from 'editor/plugins/lsp/queue'
|
import Queue from 'editor/plugins/lsp/queue'
|
||||||
import {
|
import {
|
||||||
BrowserMessageReader,
|
BrowserMessageReader,
|
||||||
BrowserMessageWriter,
|
BrowserMessageWriter,
|
||||||
} from 'vscode-languageserver-protocol/browser'
|
} from 'vscode-languageserver-protocol/browser'
|
||||||
import * as jsrpc from 'json-rpc-2.0'
|
|
||||||
|
|
||||||
class Headers {
|
class Headers {
|
||||||
static add(message: string): string {
|
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,
|
createPipeSubstitution,
|
||||||
} from './modifyAst'
|
} from './modifyAst'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { warn } from 'node:console'
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await initPromise
|
await initPromise
|
||||||
|
|||||||
@ -24,11 +24,7 @@ import {
|
|||||||
isNotLiteralArrayOrStatic,
|
isNotLiteralArrayOrStatic,
|
||||||
} from 'lang/std/sketchcombos'
|
} from 'lang/std/sketchcombos'
|
||||||
import { toolTips, ToolTip } from '../../useStore'
|
import { toolTips, ToolTip } from '../../useStore'
|
||||||
import {
|
import { createPipeExpression, splitPathAtPipeExpression } from '../modifyAst'
|
||||||
createIdentifier,
|
|
||||||
createPipeExpression,
|
|
||||||
splitPathAtPipeExpression,
|
|
||||||
} from '../modifyAst'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SketchLineHelper,
|
SketchLineHelper,
|
||||||
|
|||||||
Reference in New Issue
Block a user