fix: protocols
This commit is contained in:
parent
be153f8ab9
commit
c8a24c0c90
5 changed files with 14 additions and 6 deletions
|
|
@ -934,6 +934,11 @@ export class Core {
|
|||
void refreshIfNotIgnored(data.uris);
|
||||
}
|
||||
});
|
||||
|
||||
on("files/closed", async ({ data }) => {
|
||||
this.messenger.send("didCloseFiles", data);
|
||||
});
|
||||
|
||||
on("files/opened", async ({ data }) => {
|
||||
if (data?.uris?.length) {
|
||||
// Do something on files opened
|
||||
|
|
@ -1003,10 +1008,6 @@ export class Core {
|
|||
});
|
||||
|
||||
on("didChangeActiveTextEditor", async ({ data: { filepath } }) => {
|
||||
this.messenger.send("didChangeActiveTextEditor", {
|
||||
filepath,
|
||||
});
|
||||
|
||||
try {
|
||||
const ignore = shouldIgnore(filepath, this.ide);
|
||||
if (!ignore) {
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"files/opened": [{ uris?: string[] }, void];
|
||||
"files/created": [{ uris?: string[] }, void];
|
||||
"files/deleted": [{ uris?: string[] }, void];
|
||||
"files/closed": [{ uris?: string[] }, void];
|
||||
|
||||
// Docs etc. Indexing. TODO move codebase to this
|
||||
"indexing/reindex": [{ type: string; id: string }, void];
|
||||
|
|
|
|||
|
|
@ -84,5 +84,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
|||
"getWebviewHistoryLength",
|
||||
"getCurrentSessionId",
|
||||
"docs/suggestions",
|
||||
"didChangeActiveTextEditor",
|
||||
"didCloseFiles",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
},
|
||||
void,
|
||||
];
|
||||
didChangeActiveTextEditor: [{ filepath: string }, void];
|
||||
didCloseFiles: [{ uris: string[] }, void];
|
||||
isContinueInputFocused: [undefined, boolean];
|
||||
addContextItem: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,6 +310,12 @@ export class VsCodeExtension {
|
|||
});
|
||||
});
|
||||
|
||||
vscode.workspace.onDidCloseTextDocument(async (event) => {
|
||||
this.core.invoke("files/closed", {
|
||||
uris: [event.uri.toString()],
|
||||
});
|
||||
});
|
||||
|
||||
vscode.workspace.onDidCreateFiles(async (event) => {
|
||||
this.core.invoke("files/created", {
|
||||
uris: event.files.map((uri) => uri.toString()),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue