Skip to content

Conversation

@Eldemarkki
Copy link
Contributor

  • Implemented "Jump to definition" for bracket syntax
  • Implemented autocomplete for bracket syntax

Still missing support for combining optional chaining with bracket syntax, e.g. styles?.["mainButton"]. I didn't implement it because I don't know how important it is (I don't need it), but I can try implementing it in this PR if you want :)

Fixes #70

P.S. There were some style changes enforced by editorconfig, that's why there are so many unrelated changes.

@Eldemarkki
Copy link
Contributor Author

@clinyong I have fixed the merge conflicts, would it be possible to get this PR reviewed? :)

@clinyong
Copy link
Owner

2023, sorry😂

I'll have a look, but needs some time.

@clinyong
Copy link
Owner

@Eldemarkki Does completion work well on your side?

I cloned your branch and ran it locally. It doesn’t enter the provideCompletionItems function when I type [". Dot syntax works well.

image

@iChenLei iChenLei requested a review from Copilot May 10, 2025 10:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for bracket syntax for jump-to-definition and autocomplete functionality, addressing issue #70.

  • Added new tests to verify bracket syntax handling in jump-to-definition and autocomplete providers.
  • Updated regex patterns and parsing logic in DefinitionProvider.ts and CompletionProvider.ts to handle bracket notation.
  • Included style changes as enforced by editorconfig.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/suite/DefinitionProvider.test.ts New tests for bracket syntax jump-to-definition
src/test/suite/CompletionProvider.test.ts New tests for bracket syntax autocompletion
src/test/fixtures/sample.jsx Fixture updates to support autocompletion with bracket notation
src/DefinitionProvider.ts Enhanced parsing logic and regex to support bracket syntax
src/CompletionProvider.ts Adjusted trigger logic and word extraction for bracket syntax

@Eldemarkki
Copy link
Contributor Author

@clinyong You had to press Ctrl+Space to "manually" open the completion list. But now I added " and ' as trigger characters too, so now it should open automatically.

@clinyong clinyong merged commit 92ff98d into clinyong:master May 11, 2025
2 checks passed
@clinyong
Copy link
Owner

LGTM~ Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bracket syntax cannot jump

2 participants