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

Prevent completions when in JSX nodes #14

Merged
merged 1 commit into from
Nov 24, 2024
Merged

Conversation

krismuniz
Copy link
Contributor

@krismuniz krismuniz commented Nov 23, 2024

Hi there 👋

This contribution adds "JSXText", "JSXAttributeValue", "JSXOpenTag", "JSXCloseTag", "JSXSelfClosingTag" to dontComplete to ensure that we do not show JavaScript completions when in a JSX node.

Minimal Repro - Try Codemirror

Examples

export function MyComponent () {
  return <p>func|
/*              ^ cursor
 * I'm inside of a JSXText node, but it would
 * show `function` as a completion, which is
 * not very useful inside of a `JSXText`
 */
export function MyComponent () {
  return <p className="func|
/*                         ^ cursor
 * I'm inside of a JSXAttributeValue node,
 * but it would show `function` as a
 * completion, which is not very useful
 * inside of a `JSXAttributeValue`
 */

Screenshots - Before

CleanShot 2024-11-23 at 10 18 17@2x

CleanShot 2024-11-23 at 10 17 16@2x

Screenshots - After

CleanShot.2024-11-23.at.10.36.58.mp4

@krismuniz krismuniz changed the title Prevent autocomplete when in JSX Prevent completions when in JSX nodes Nov 23, 2024
@marijnh marijnh merged commit 1d8e74b into codemirror:main Nov 24, 2024
@marijnh
Copy link
Member

marijnh commented Nov 24, 2024

Thanks, that looks like a good idea.

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.

2 participants