dan-c-underwood / vscode-arm

Arm® Syntax highlighting for VSCode
MIT License
41 stars 19 forks source link

Show tooltip with more info #24

Open gparmeggiani opened 3 years ago

gparmeggiani commented 3 years ago

Hi,

I think it would be very useful if a tooltip appeared every time I hovered on an instruction. Ideally, in this tooltip I'd like to see a description of the instruction and some other details, like the number of cycles it takes to execute (according to the instruction set manual).

I'm not sure how hard/easy it is to implement this and if the tmlanguage support this. If it is just a matter of data-entry, I'd be happy to contribute.

dan-c-underwood commented 3 years ago

Hey! Thanks for the suggestion. I've had challenges around this sort of topic before with copyright restrictions and the Arm reference manuals. E.g., in the Armv8 reference manual it states:

No part of this document may be reproduced in any form by any means without the express prior written permission of Arm.

I've struggled to get permission for similar activities in writing from Arm, however that was a number of years ago. I'll reach out to them again and see what they say.

gparmeggiani commented 3 years ago

I see. Let's hope they understand.

Would the tmlanguage file easily allow for a description tooltip or would this require a more involved development?

If adding the instruction documentation in the plugin itself is not allowed, maybe it is still possible to load it from the ARM webpage and display it in a tooltip in VSCode. (not sure if this makes any difference)

dan-c-underwood commented 3 years ago

I think it would require going down the programmatic route (other languages use a language server for this) however I could potentially get some of the way with snippets.

However, I'm not opposed to the programmatic route, but it would be a substantial increase in complexity for the project. So I couldn't promise timescales, but also would be open to contributions.

Sadly the Arm knowledge base has now been replaced with a PDF download of the reference manual, so sadly it's much harder to load remotely!

gparmeggiani commented 3 years ago

https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools

I think it would be cool and doable under ARM's terms, if the plugin requires the user to download the XML from the page above and use that as a source for the descriptions. Unfortunately it looks like that XML is only available for A-profile CPUs and not for the others.

I've also had a look at the vscode documentation and it looks that a language server is needed for this, especially if loading an external XML is the way to go. (which, I agree, increases to complexity of the project)

dan-c-underwood commented 3 years ago

Ah, I hadn't spotted that - I'll try to take a look to make sure that route will work soon, as well as from the increased complexity of the language server aspect. I can't promise timescales, but I will promise that I'll investigate it!

verhovsky commented 10 months ago

You can use the data from Compiler Explorer:

https://github.com/compiler-explorer/compiler-explorer/blob/730437464d7900a1f232345db0bc196bfa1bbaeb/lib/asm-docs/arm.ts

https://github.com/compiler-explorer/compiler-explorer/blob/730437464d7900a1f232345db0bc196bfa1bbaeb/lib/asm-docs/generated/asm-docs-aarch64.ts