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

Enumeration documentation is not displayed #233

Closed
MAHTasklet opened this issue Mar 24, 2020 · 13 comments · Fixed by eclipse/lemminx#623 or enxio/lsp4xml#25
Closed

Enumeration documentation is not displayed #233

MAHTasklet opened this issue Mar 24, 2020 · 13 comments · Fixed by eclipse/lemminx#623 or enxio/lsp4xml#25
Labels
bug Something isn't working hover
Milestone

Comments

@MAHTasklet
Copy link

MAHTasklet commented Mar 24, 2020

This is a great plug-in thanks for that.

I have a minor issue, that annotation/documentation is not displayed for xs:enumeration items, either when hovering over items in the selection list or when hovering the value after selecting.
In the example below only the documentation from the xs:simpleType is displayed.
I have also noticed, that if the top level element (xs:simpleType) does not have documentation, then the documentation for the last enumeration is used.

I have tested in Visual Studio that the documentation is written correctly, and displayed when hovering.

Let me know, if I need to do something different, or test a fix.

Sorry about the formatting, I have not been able to make it look better.

<xs:simpleType name="PrimaryInputMethodType">
  <xs:annotation>
    <xs:documentation>The primary input method for the step. The step will use the Control as default but can be modified to e.g. ask the user to scan</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
    <xs:enumeration value="Control" >
      <xs:annotation>
        <xs:documentation>The normal control will be shown.</xs:documentation>
      </xs:annotation>
    </xs:enumeration>
    <xs:enumeration value="Scan" >
      <xs:annotation>
        <xs:documentation>The primary input will be scan and the step element can act accordingly e.g. the InputLineType.Text will show a SCAN icon with the possibility to manually enter the value.</xs:documentation>
      </xs:annotation>
    </xs:enumeration>
    <xs:enumeration value="ScanOnly" >
      <xs:annotation>
        <xs:documentation>
          The 'ScanOnly' differs from the 'Scan' in the way that the user cannot enter a value manually. The SCAN icon is displayed but it will not show the edit field.
          This is only applicable for InputLineType.Text.
        </xs:documentation>
      </xs:annotation>
    </xs:enumeration>
  </xs:restriction>
</xs:simpleType>

Best regards
Morten

@angelozerr
Copy link
Contributor

This is a great plug-in thanks for that.

Glad it pleases you!

Could you give us a XML sample and full XML Schema which causes the problem, it will help us to understand quickly the missing feature and we will able to use your usecase for writing tests.

@MAHTasklet
Copy link
Author

Yes.
Let me create one and post it here.

@MAHTasklet
Copy link
Author

Here goes:
Notice that when using the extension and hovering over the type attribute or any of the values, the last documentation is displayed. In Visual Studio hovering over the type attribute displays the documentation added for the type, and hovering over the different values displays their documentation.

Hope this helps. If not, let me know.

SchemaTest.zip

@angelozerr
Copy link
Contributor

angelozerr commented Mar 24, 2020

@MAHTasklet thanks for your zip. I try to understand the problem, if I hover D365FO, I see documentation from AX type (Used when connecting to AX2012 and above.)

image

but it should display Used when connecting to Dynamics AX 365 for Finance and Operations.

Is this problem that you mention?

@MAHTasklet
Copy link
Author

Yes.
That is the problem. Also, if you hover over the type= attribute, then the same documentation you mention is displayed which should be "The type of Backend ERP system."

@angelozerr
Copy link
Contributor

In Visual Studio hovering over the type attribute displays the documentation added for the type, and hovering over the different values displays their documentation.

Could you add a screenshot please.

@MAHTasklet
Copy link
Author

The mouse is not visible but hovering the type= part underlined here.
image

@angelozerr
Copy link
Contributor

Ok and when you hover the NAV value, you see the document of the NAV (or merged documentation of the type and NAV documentation?)

@MAHTasklet
Copy link
Author

No. It's the same value if I hover anything. regarding the type= attribute. That includes the actual attribute name (type=) or any entered values (AX, NAV, D365FO). Oddly enough, mine does display a different value that what you display, namely "Used when connecting to Dynamics AX 365 for Finance and Operations". However, always that value.

I just discovered that if I close VS Code, then whatever part of the type="" that is hovered, is the value that will always be displayed when hovering, even type attributes on different elements.

@MAHTasklet
Copy link
Author

MAHTasklet commented Mar 24, 2020

To recreate:
Close VS Code
Open VS Code
Hover the D365FO value.
Notice that the correct value is displayed.
Now hover the AX value.
Notice that the documentation for the D365FO is displayed.
Now hover the type= attribute.
Notice that the documentation for the D365FO is displayed.

Now repeat all steps, and choose another starting point e.g. hovering the type= attribute, and notice that whatever you hover, documentation of the initial element is always displayed.

@angelozerr
Copy link
Contributor

Ok if I understand correctly the problem, it's a cache problem. It seems hover is working the first time (if you hover the type attribute the first time, it works, if you hover AX value the first time it works, etc), but problem occurs for the second hover which is different from the first.

Is it that, or is there another problem?

I can reproduce the problem and I'm creating a PR for that.

@angelozerr
Copy link
Contributor

@MAHTasklet here the result of eclipse/lemminx#623

XMLHoverDemo

Is it OK for you?

@MAHTasklet
Copy link
Author

That looks awesome.
Thank you very much for the quick fix.

fbricon pushed a commit to eclipse/lemminx that referenced this issue Mar 25, 2020
@fbricon fbricon added this to the 0.11.0 milestone Mar 25, 2020
@fbricon fbricon added bug Something isn't working hover labels Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hover
Projects
None yet
3 participants