add updateLastFileSaveTimestamp method to IDE interface and call it on file save in VsCodeExtension
This commit is contained in:
parent
a3e0b12838
commit
62d7fc75b3
3 changed files with 27 additions and 32 deletions
46
core/index.d.ts
vendored
46
core/index.d.ts
vendored
|
|
@ -43,13 +43,13 @@ export interface IndexingProgressUpdate {
|
|||
desc: string;
|
||||
shouldClearIndexes?: boolean;
|
||||
status:
|
||||
| "loading"
|
||||
| "indexing"
|
||||
| "done"
|
||||
| "failed"
|
||||
| "paused"
|
||||
| "disabled"
|
||||
| "cancelled";
|
||||
| "loading"
|
||||
| "indexing"
|
||||
| "done"
|
||||
| "failed"
|
||||
| "paused"
|
||||
| "disabled"
|
||||
| "cancelled";
|
||||
debugInfo?: string;
|
||||
}
|
||||
|
||||
|
|
@ -666,14 +666,16 @@ export interface IDE {
|
|||
getCurrentFile(): Promise<
|
||||
| undefined
|
||||
| {
|
||||
isUntitled: boolean;
|
||||
path: string;
|
||||
contents: string;
|
||||
}
|
||||
isUntitled: boolean;
|
||||
path: string;
|
||||
contents: string;
|
||||
}
|
||||
>;
|
||||
|
||||
getLastFileSaveTimestamp?(): number;
|
||||
|
||||
updateLastFileSaveTimestamp?(): void;
|
||||
|
||||
getPinnedFiles(): Promise<string[]>;
|
||||
|
||||
getSearchResults(query: string): Promise<string>;
|
||||
|
|
@ -850,11 +852,11 @@ export interface CustomCommand {
|
|||
export interface Prediction {
|
||||
type: "content";
|
||||
content:
|
||||
| string
|
||||
| {
|
||||
type: "text";
|
||||
text: string;
|
||||
}[];
|
||||
| string
|
||||
| {
|
||||
type: "text";
|
||||
text: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface ToolExtras {
|
||||
|
|
@ -1176,9 +1178,9 @@ export interface Config {
|
|||
embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
|
||||
/** The model that Continue will use for tab autocompletions. */
|
||||
tabAutocompleteModel?:
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
/** Options for tab autocomplete */
|
||||
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
|
||||
/** UI styles customization */
|
||||
|
|
@ -1269,9 +1271,9 @@ export type PackageDetailsSuccess = PackageDetails & {
|
|||
export type PackageDocsResult = {
|
||||
packageInfo: ParsedPackageInfo;
|
||||
} & (
|
||||
| { error: string; details?: never }
|
||||
| { details: PackageDetailsSuccess; error?: never }
|
||||
);
|
||||
| { error: string; details?: never }
|
||||
| { details: PackageDetailsSuccess; error?: never }
|
||||
);
|
||||
|
||||
export interface TerminalOptions {
|
||||
reuseTerminal?: boolean;
|
||||
|
|
|
|||
|
|
@ -41,16 +41,9 @@ class VsCodeIde implements IDE {
|
|||
) {
|
||||
this.ideUtils = new VsCodeIdeUtils();
|
||||
this.secretStorage = new SecretStorage(context);
|
||||
this.registerSaveWatcher();
|
||||
}
|
||||
|
||||
public registerSaveWatcher() {
|
||||
vscode.workspace.onDidSaveTextDocument(async (event) => {
|
||||
this.updateLastFileSaveTimestamp();
|
||||
});
|
||||
}
|
||||
|
||||
private updateLastFileSaveTimestamp(): void {
|
||||
public updateLastFileSaveTimestamp(): void {
|
||||
this.lastFileSaveTimestamp = Date.now();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ export class VsCodeExtension {
|
|||
});
|
||||
|
||||
vscode.workspace.onDidSaveTextDocument(async (event) => {
|
||||
this.ide.updateLastFileSaveTimestamp();
|
||||
this.core.invoke("files/changed", {
|
||||
uris: [event.uri.toString()],
|
||||
});
|
||||
|
|
@ -354,8 +355,7 @@ export class VsCodeExtension {
|
|||
|
||||
// Register a content provider for the readonly virtual documents
|
||||
const documentContentProvider = new (class
|
||||
implements vscode.TextDocumentContentProvider
|
||||
{
|
||||
implements vscode.TextDocumentContentProvider {
|
||||
// emitter and its event
|
||||
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
|
||||
onDidChange = this.onDidChangeEmitter.event;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue