Skip to content
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

fix(core): fix autocomplete for defineType in VSCode #6447

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

ricokahler
Copy link
Contributor

@ricokahler ricokahler commented Apr 22, 2024

Description

Supersedes #6426 by @GregorGabric. Include the original commit by @GregorGabric.

This pull request introduces a small but crucial change to the typing of the defineType function to improve the autocomplete experience in VSCode.

The original implementation used a type parameter that extended string | IntrinsicTypeName, which caused VSCode's autocomplete to not effectively prioritize or sometimes display the specific string literals defined under IntrinsicTypeName. This was due to the broad nature of the string type overwhelming the specific suggestions that IntrinsicTypeName could provide.

By introducing an intersection type AllowOtherStrings = string & {}, we differentiate the generic string type from our specific string type (IntrinsicTypeName). This subtle change encourages TypeScript's type inference system to handle these types distinctly, thereby improving the relevance and prioritization of autocomplete suggestions in VSCode.

What to review

Does the change make sense? Does it affect more than it should?

Testing

  • Ran the build and tried it in a studio. It's a great improvement!

Notes for release

Improves autocomplete in VSCode for defineType and defineField with more relevant suggestions. Thanks @GregorGabric!

@ricokahler ricokahler requested a review from a team as a code owner April 22, 2024 20:42
@ricokahler ricokahler requested review from jtpetty and removed request for a team April 22, 2024 20:42
Copy link

vercel bot commented Apr 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Apr 22, 2024 8:59pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 8:59pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Apr 22, 2024 8:59pm

@ricokahler ricokahler changed the title Feat/enable auto complete for type fix(core): fix autocomplete for defineType in VSCode Apr 22, 2024
@ricokahler ricokahler force-pushed the feat/enable-auto-complete-for-type branch from 351e424 to 3d20da2 Compare April 22, 2024 20:47
@ricokahler ricokahler force-pushed the feat/enable-auto-complete-for-type branch from 3d20da2 to 0333907 Compare April 22, 2024 20:51
@ricokahler ricokahler force-pushed the feat/enable-auto-complete-for-type branch from 0333907 to 4205ef7 Compare April 22, 2024 20:52
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Apr 22, 2024

Component Testing Report Updated Apr 22, 2024 9:01 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 33s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 13s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 34s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 1s 14 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 2s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 21s 9 0 0

@ricokahler ricokahler requested review from binoy14 and removed request for jtpetty April 22, 2024 21:01
@ricokahler ricokahler added this pull request to the merge queue Apr 22, 2024
Merged via the queue into next with commit 3ff78f6 Apr 22, 2024
37 checks passed
@ricokahler ricokahler deleted the feat/enable-auto-complete-for-type branch April 22, 2024 21:04
jordanl17 pushed a commit that referenced this pull request Apr 23, 2024
* feat(core): improve defineType TType

* fix: add tsdoc comment; add to `defineField` and `defineArrayMember`

---------

Co-authored-by: Gregor Gabrič <gregor.gabric@outlook.com>
cngonzalez pushed a commit that referenced this pull request May 8, 2024
* feat(core): improve defineType TType

* fix: add tsdoc comment; add to `defineField` and `defineArrayMember`

---------

Co-authored-by: Gregor Gabrič <gregor.gabric@outlook.com>
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.

3 participants