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

Implement itemDefaults for completionList #1567

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

JessicaJHee
Copy link
Contributor

Fixes #1561

  • moves editRange and insertTextFormat to itemDefaults when supported

@datho7561
Copy link
Contributor

Given the schema:

<grammar xmlns="http://relaxng.org/ns/structure/1.0"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="articleContent" />
  </start>
  <define name="articleContent">
    <element name="article">
      <choice>
        <ref name="titleContent" />
        <ref name="titleLineContent" />
      </choice>
      <element name="salami">
        <text/>
      </element>
    </element>
  </define>
  <define name="titleContent">
    <choice>
      <element name="title">
        <empty />
      </element>
    </choice>
  </define>
  <define name="titleLineContent">
    <element name="title2">
      <choice>
        <ref name="lineElt"></ref>
        <ref name="thirdNest"></ref>
      </choice>
    </element>
  </define>
  <define name="thirdNest">
    <choice>
      <element name="nest1">
        <empty/>
      </element>
      <element name="nest2">
        <empty/>
      </element>
      <element name="nest3">
        <empty/>
      </element>
    </choice>
  </define>
  <define name="lineElt">
    <element name="line">
      <text />
    </element>
  </define>
</grammar>

And the document:

<?xml-model href="schema.rng"?>
<article>
    |
</article>

If I open completion at the |, I get title and title2 suggested as expected, but when I apply completion, I get the following result:

<?xml-model href="schema.rng"?>
<article>
    title
</article>

@datho7561
Copy link
Contributor

It seems the itemDefaults is almost always {}, since the snippets and the element completions have different data.

@JessicaJHee
Copy link
Contributor Author

@datho7561 Hmm it works on my end, do you have any settings set that might affect completion?

@datho7561
Copy link
Contributor

I'll give it another try

@datho7561
Copy link
Contributor

I know what it is, it's the binary. You will need to add org.eclipse.lsp4j.CompletionItemDefaults to the reflection configuration in order for it to work

@angelozerr
Copy link
Contributor

@JessicaJHee do you see some improvement with lemminx maven with the dependency completion eclipse/lemminx-maven#482 ?

Signed-off-by: Jessica He <jhe@redhat.com>
@JessicaJHee
Copy link
Contributor Author

do you see some improvement with lemminx maven with the dependency completion eclipse/lemminx-maven#482 ?

@angelozerr I do feel that it is faster, at least on the first completion. But it is hard to put into numbers since the improvements are purely on the client side.

@angelozerr
Copy link
Contributor

Yes sure I understand, I wanted just to have your feeling. Thanks for your feedback.

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks, Jessica!

@angelozerr
Copy link
Contributor

It works great on vscode.

I cannot test with Eclipse IDE because it misses the capability eclipse/lsp4e#741 -(

@angelozerr
Copy link
Contributor

Once github actions will be finished,I'm OK to merge it.

@angelozerr angelozerr merged commit fd32765 into eclipse:main Aug 2, 2023
4 checks passed
@angelozerr
Copy link
Contributor

Thanks @JessicaJHee !

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.

Implement itemDefaults for CompletionList
3 participants