Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions runtimes/protocol/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import {
OpenFileDiffParams,
ProtocolNotificationType,
ProtocolRequestType,
ResponseError,
SELECT_WORKSPACE_ITEM_REQUEST_METHOD,
SelectWorkspaceItemParams,
SelectWorkspaceItemResult,
URI,
} from './lsp'

export const selectWorkspaceItemRequestType = new ProtocolRequestType<
Expand Down Expand Up @@ -46,3 +48,15 @@ export const didAppendFileNotificationType = new ProtocolNotificationType<FilePa
export const didCreateDirectoryNotificationType = new ProtocolNotificationType<FileParams, void>(
DID_CREATE_DIRECTORY_NOTIFICATION_METHOD
)

export interface SaveWorkspaceDocumentParams {
uri: string
}

export const saveWorkspaceDocumentRequestType = new ProtocolRequestType<
SaveWorkspaceDocumentParams,
null,
never,
ResponseError,
void
>('aws/saveWorkspaceDocument')
3 changes: 3 additions & 0 deletions runtimes/runtimes/base-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
buttonClickRequestType,
listMcpServersRequestType,
mcpServerClickRequestType,
saveWorkspaceDocumentRequestType,
} from '../protocol'
import { createConnection } from 'vscode-languageserver/browser'
import {
Expand Down Expand Up @@ -239,6 +240,8 @@ export const baseRuntime = (connections: { reader: MessageReader; writer: Messag
onUpdateConfiguration: lspServer.setUpdateConfigurationHandler,
selectWorkspaceItem: params => lspConnection.sendRequest(selectWorkspaceItemRequestType.method, params),
openFileDiff: params => lspConnection.sendNotification(openFileDiffNotificationType.method, params),
saveWorkspaceDocument: params =>
lspConnection.sendRequest(saveWorkspaceDocumentRequestType.method, params),
},
window: {
showMessage: params => lspConnection.sendNotification(ShowMessageNotification.method, params),
Expand Down
3 changes: 3 additions & 0 deletions runtimes/runtimes/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
didWriteFileNotificationType,
didAppendFileNotificationType,
didCreateDirectoryNotificationType,
saveWorkspaceDocumentRequestType,
} from '../protocol'
import { ProposedFeatures, createConnection } from 'vscode-languageserver/node'
import {
Expand Down Expand Up @@ -386,6 +387,8 @@ export const standalone = (props: RuntimeProps) => {
selectWorkspaceItem: params =>
lspConnection.sendRequest(selectWorkspaceItemRequestType.method, params),
openFileDiff: params => lspConnection.sendNotification(openFileDiffNotificationType.method, params),
saveWorkspaceDocument: params =>
lspConnection.sendRequest(saveWorkspaceDocumentRequestType.method, params),
},
window: {
showMessage: params => lspConnection.sendNotification(ShowMessageNotification.method, params),
Expand Down
2 changes: 2 additions & 0 deletions runtimes/server-interface/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
SelectWorkspaceItemResult,
ShowSaveFileDialogParams,
ShowSaveFileDialogResult,
SaveWorkspaceDocumentParams,
} from '../protocol'

// Re-export whole surface of LSP protocol used in Runtimes.
Expand Down Expand Up @@ -145,6 +146,7 @@ export type Lsp = {
handler: RequestHandler<SelectWorkspaceItemParams, SelectWorkspaceItemResult | undefined | null, void>
) => void
openFileDiff: (params: OpenFileDiffParams) => void
saveWorkspaceDocument: (params: SaveWorkspaceDocumentParams) => Promise<void>
}
window: {
showMessage: (params: ShowMessageParams) => Promise<void>
Expand Down