Skip to content

Commit

Permalink
Merge branch 'main' into nate/tool-use
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Nov 26, 2024
2 parents d9b5540 + c241a5a commit 9985c9e
Show file tree
Hide file tree
Showing 130 changed files with 2,544 additions and 1,756 deletions.
25 changes: 25 additions & 0 deletions .changes/extensions/vscode/0.8.58.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## 0.8.58 - 2024-11-22
### Added
* OpenAI predicted outputs support
* Improve codebase retrieval with BM25
* Support for Grok from xAI
* Chat enhancements including sticking input to bottom
* New UI for cmd+I in sidebar
* Support for Nebius LLM provider
* Support for Ask Sage LLM provider
* Improved reference for config.json
* New @web context provider
* Updates for llama3.2
* .continuerules file to set system prompt
* .prompt files v2
* Dedicated UI for docs indexing
* Clickable code symbols in chat
* Use clipboard content as autocomplete context
### Changed
* Improved @docs crawler
* Many improvements to make autocomplete more eager
* Near complete type definition retrieval for TypeScript autocomplete
* Remove footer from chat sidebar
### Fixed
* Brought back the Apply button for all code blocks
* Automatically update codebase index on removed files
3 changes: 3 additions & 0 deletions .changes/extensions/vscode/0.8.59.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.8.59 - 2024-11-25
### Fixed
* Hotfix for Ollama onboarding
4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-113942.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114100.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114423.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114437.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114450.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114612.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114622.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114649.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114753.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241108-114813.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241113-165958.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Added-20241113-170006.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Changed-20241108-114549.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Changed-20241108-114850.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .changes/unreleased/Fixed-20241108-114905.yaml

This file was deleted.

100 changes: 0 additions & 100 deletions .github/workflows/ts-check.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

73 changes: 13 additions & 60 deletions core/autocomplete/CompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import OpenAI from "../llm/llms/OpenAI.js";
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters.js";

import { shouldCompleteMultiline } from "./classification/shouldCompleteMultiline.js";
import { AutocompleteLanguageInfo } from "./constants/AutocompleteLanguageInfo.js";
import { aggregateSnippets } from "./aggregateSnippets";
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
// @prettier-ignore

import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
import { AutocompleteSnippet } from "./context/ranking/index.js";
import { BracketMatchingService } from "./filtering/BracketMatchingService.js";
import { CompletionStreamer } from "./generation/CompletionStreamer.js";
import { postprocessCompletion } from "./postprocessing/index.js";
import { shouldPrefilter } from "./prefiltering/index.js";
import { getAllSnippets } from "./snippets/index.js";
import { renderPrompt } from "./templating/index.js";
import { GetLspDefinitionsFunction } from "./types.js";
import { AutocompleteDebouncer } from "./util/AutocompleteDebouncer.js";
import { AutocompleteLoggingService } from "./util/AutocompleteLoggingService.js";
import AutocompleteLruCache from "./util/AutocompleteLruCache.js";
Expand All @@ -32,14 +31,6 @@ const ERRORS_TO_IGNORE = [
"operation was aborted",
];

export type GetLspDefinitionsFunction = (
filepath: string,
contents: string,
cursorIndex: number,
ide: IDE,
lang: AutocompleteLanguageInfo,
) => Promise<AutocompleteSnippet[]>;

export class CompletionProvider {
private autocompleteCache = AutocompleteLruCache.get();
public errorsShown: Set<string> = new Set();
Expand Down Expand Up @@ -171,28 +162,18 @@ export class CompletionProvider {
token = controller.signal;
}

//////////

// Some IDEs might have special ways of finding snippets (e.g. JetBrains and VS Code have different "LSP-equivalent" systems,
// or they might separately track recently edited ranges)
const extraSnippets = await this._getExtraSnippets(helper);

const [snippets, diff, clipboardContent, workspaceDirs] =
await Promise.all([
aggregateSnippets(
helper,
extraSnippets,
this.contextRetrievalService,
),
this.ide.getDiff(true),
this.ide.getClipboardContent(),
this.ide.getWorkspaceDirs(),
]);
const [snippetPayload, workspaceDirs] = await Promise.all([
getAllSnippets({
helper,
ide: this.ide,
getDefinitionsFromLsp: this.getDefinitionsFromLsp,
contextRetrievalService: this.contextRetrievalService,
}),
this.ide.getWorkspaceDirs(),
]);

const { prompt, prefix, suffix, completionOptions } = renderPrompt({
snippets,
diff,
clipboardContent,
snippetPayload,
workspaceDirs,
helper,
});
Expand Down Expand Up @@ -288,32 +269,4 @@ export class CompletionProvider {
this.loggingService.deleteAbortController(input.completionId);
}
}

private async _getExtraSnippets(
helper: HelperVars,
): Promise<AutocompleteSnippet[]> {
let extraSnippets = helper.options.useOtherFiles
? ((await Promise.race([
this.getDefinitionsFromLsp(
helper.input.filepath,
helper.fullPrefix + helper.fullSuffix,
helper.fullPrefix.length,
this.ide,
helper.lang,
),
new Promise((resolve) => {
setTimeout(() => resolve([]), 100);
}),
])) as AutocompleteSnippet[])
: [];

const workspaceDirs = await this.ide.getWorkspaceDirs();
if (helper.options.onlyMyCode) {
extraSnippets = extraSnippets.filter((snippet) => {
return workspaceDirs.some((dir) => snippet.filepath.startsWith(dir));
});
}

return extraSnippets;
}
}
2 changes: 0 additions & 2 deletions core/autocomplete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ This is just another object like the ones in the `"models"` array of `config.jso

This object allows you to customize the behavior of tab-autocomplete. The available options are:

- `useCopyBuffer`: Determines whether the copy buffer will be considered when constructing the prompt. (Boolean)
- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean)
- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)
- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number)
Expand All @@ -107,7 +106,6 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
"apiBase": "https://<my endpoint>"
},
"tabAutocompleteOptions": {
"useCopyBuffer": false,
"maxPromptTokens": 400,
"prefixPercentage": 0.5
}
Expand Down
45 changes: 0 additions & 45 deletions core/autocomplete/aggregateSnippets.ts

This file was deleted.

Loading

0 comments on commit 9985c9e

Please sign in to comment.