Skip to content

refactor(vscode-extension): remove duplicated getTokenAtPosition in c…#68893

Open
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:vscode-extension-dedupe-get-token-at-position
Open

refactor(vscode-extension): remove duplicated getTokenAtPosition in c…#68893
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:vscode-extension-dedupe-get-token-at-position

Conversation

@erkamyaman
Copy link
Copy Markdown
Contributor

The completions handler kept a local copy of getTokenAtPosition plus three stale TODO comments noting the duplication, but the function is already exported from server/src/utils.ts (hover.ts and others import it from there). Drop the local copy, import the canonical one, and remove the now-meaningless comments.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

completions.ts keeps a local copy of getTokenAtPosition plus three stale TODO comments asking for the duplication to be cleaned up. The canonical version already lives in server/src/utils.ts and is consumed by hover.ts and other handlers, completions is the last duplicate.

What is the new behavior?

  • Import getTokenAtPosition from ../utils in completions.ts (extending the existing import block).
  • Delete the duplicated local function.
  • Delete the three stale TODO/notes-to-self comments.

No behavioral change. 21 lines removed, 1 line added.

Does this PR introduce a breaking change?

  • Yes
  • No

…ompletions handler

The completions handler kept a local copy of getTokenAtPosition plus three stale TODO comments noting the duplication, but the function is already exported from server/src/utils.ts (hover.ts and others import it from there). Drop the local copy, import the canonical one, and remove the now-meaningless comments.
@pullapprove pullapprove Bot requested a review from crisbeto May 22, 2026 21:32
@angular-robot angular-robot Bot added the area: vscode-extension Issues related to the Angular Language Service VsCode extension label May 22, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: vscode-extension Issues related to the Angular Language Service VsCode extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant