Skip to content

Feature/nextEdit #5921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 31, 2025
Merged

Feature/nextEdit #5921

merged 9 commits into from
May 31, 2025

Conversation

jpoly1219
Copy link
Collaborator

Description

Merge #5919 and #5920.

5919:

Initial commits. Next edit module is created and is called alongside autocomplete. This is extremely rudimentary with no custom logic - the code is shamelessly copied over from the core/autocomplete directory, and all imports are pointing back to that directory. In the future, when we start adding more custom algorithms and types, we will slowly cut ties to the core/autocomplete directory and create our own internal definitions.

For now, this works only inside vscode. Jetbrains should require a custom message to some endpoint like "nextEdit/predict".

5920:

Turn off next edit for other users until it is ready.

This only targets vscode -- we need another check for jetbrains. I don't see any message endpoints defined for next edit for the jetbrains extension, so we should be good for now.

Checklist

  • [*] I've read the contributing guide
  • [*] The relevant docs, if any, have been updated or created
  • [*] The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

@jpoly1219 jpoly1219 requested a review from a team as a code owner May 30, 2025 23:49
@jpoly1219 jpoly1219 requested review from sestinj and removed request for a team May 30, 2025 23:49
Copy link

cubic-dev-ai bot commented May 30, 2025

Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic.

Copy link

netlify bot commented May 30, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 24b6104
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/683a52bf6402a1000820c863

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 30, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like constants.ts for consistency with the rest of the codebase?

Comment on lines +7 to +21
import { shouldCompleteMultiline } from "../autocomplete/classification/shouldCompleteMultiline.js";
import { ContextRetrievalService } from "../autocomplete/context/ContextRetrievalService.js";

import { BracketMatchingService } from "../autocomplete/filtering/BracketMatchingService.js";
import { CompletionStreamer } from "../autocomplete/generation/CompletionStreamer.js";
import { postprocessCompletion } from "../autocomplete/postprocessing/index.js";
import { shouldPrefilter } from "../autocomplete/prefiltering/index.js";
import { getAllSnippets } from "../autocomplete/snippets/index.js";
import { renderPrompt } from "../autocomplete/templating/index.js";
import { GetLspDefinitionsFunction } from "../autocomplete/types.js";
import { AutocompleteDebouncer } from "../autocomplete/util/AutocompleteDebouncer.js";
import { AutocompleteLoggingService } from "../autocomplete/util/AutocompleteLoggingService.js";
import AutocompleteLruCache from "../autocomplete/util/AutocompleteLruCache.js";
import { HelperVars } from "../autocomplete/util/HelperVars.js";
import { AutocompleteInput, AutocompleteOutcome } from "../autocomplete/util/types.js";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ok for now but long-term it's better to avoid importing implementation details from sibling services. This makes it easy to create circular dependencies, which will eventually lead to bugs and are often difficult to resolve.

For example, someone else could, in the future, import implementation details from nextEdit into autocomplete and it generate a circular dependency that way.

It's usually better to move the reusable elements to a third directory that both siblings import from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't like to make deps this way either :( I didn't feel like making exact copies of these files inside the core/nextEdit directory, although that would've been "safer" because the dependencies are contained within core/nextEdit. My plan here is to phase these imports out gradually as we add more features to next edit.

@@ -83,12 +86,21 @@ export class ContinueCompletionProvider
this.onError.bind(this),
getDefinitionsFromLsp,
);
// NOTE: Only turn it on locally when testing (for review purposes).
if (!IGNORE_NEXT_EDIT) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming-wise, it's better to not have "negative" boolean flags. For example, instead of IGNORE_NEXT_EDIT you could use IS_NEXT_EDIT_ACTIVE. This helps avoid confusion and makes control flows simpler (no negation needed).

Suggested change
if (!IGNORE_NEXT_EDIT) {
if (IS_NEXT_EDIT_ACTIVE) {

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs May 31, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 31, 2025
@jpoly1219 jpoly1219 merged commit b402553 into main May 31, 2025
63 of 65 checks passed
@jpoly1219 jpoly1219 deleted the feature/nextEdit branch May 31, 2025 20:09
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs May 31, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2025
@jpoly1219 jpoly1219 restored the feature/nextEdit branch May 31, 2025 20:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants