Skip to content

Prevent completions when in JSX nodes#14

Merged
marijnh merged 1 commit intocodemirror:mainfrom
krismuniz:main
Nov 24, 2024
Merged

Prevent completions when in JSX nodes#14
marijnh merged 1 commit intocodemirror:mainfrom
krismuniz:main

Conversation

@krismuniz
Copy link
Copy Markdown
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
Copy Markdown
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