idaholab / moose-language-support

MOOSE language support for VSCode
Other
5 stars 4 forks source link

Show list of available options #8

Closed hugary1995 closed 2 years ago

hugary1995 commented 2 years ago

I am not sure if this is a missing feature, but this has been possible in Atom and was quite useful:

When the editor focus is here: image

If I press space in Atom it will show me a list of available options, but nothing happens in VSCode. Perhaps there is another way to do this. Idk

dschwen commented 2 years ago

Press ctrl-space instead. I can look into this. I might be able to add space as a trigger key for auto complete.

On Tue, Jul 5, 2022, 6:55 AM Gary (Tianchen) Hu @.***> wrote:

I am not sure if this is a missing feature, but this has been possible in Atom and was quite useful:

When the editor focus is here: [image: image] https://user-images.githubusercontent.com/31555204/177332095-fcefc026-7c9c-4344-b188-5c0d85a45802.png

If I press space in Atom it will show me a list of available options, but nothing happens in VSCode. Perhaps there is another way to do this. Idk

— Reply to this email directly, view it on GitHub https://github.com/idaholab/moose-language-support/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRMPQIGYEBSSTYG77JR7LVSQWCTANCNFSM52WEAD4Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

hugary1995 commented 2 years ago

Thanks. ctrl-space is as good as anything.

hugary1995 commented 2 years ago

The ctrl-space list shows a bunch of irrelevant parameters that don't belong to the object.

dschwen commented 2 years ago

I'll investigate. Is there a certain input that triggers this?

hugary1995 commented 2 years ago
[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 2
    xmax = 5
    ymax = 2
    nx = 50
    ny = 20
  []
  [subdomain]
    type = SubdomainBoundingBoxGenerator
    input = gmg
    bottom_left = '0 0 0'
    top_right = '2 2 0'
    block_id = 1
  []
  [break]
    type = BreakMeshByBlockGenerator

  []
[]

If I press ctrl-space at the empty line, I get bottom_left and top_right shown in the list of available options, among others.

dschwen commented 2 years ago

image

I don't see those rogue parameters.

dschwen commented 2 years ago

Are those rogue parameters shown with an abc icon? That would mean they come from the built in autocomplete that just takes words from the current document as the basis.

hugary1995 commented 2 years ago

They are not shown with an abc icon. But here's more information:

  1. If I open a brand new input file, the first time I do ctrl-space inside Mesh/break, the behavior is correct.
  2. Then if I go to another object, say Mesh/subdomain and press ctrl-space, some rogue parameters will show up, and they come from Mesh/break.
  3. After that, if I go back to Mesh/break and press ctrl-space, the rogue parameters will show up, and they come from Mesh/break.

So it seems to me that the list of options are being cached somehow.

dschwen commented 2 years ago

Ok, found the bug. Any assignment of an object or array in JavaScript is by default assigning it like a reference to the original. So the plugin was actually polluting the syntax definition.

dschwen commented 2 years ago

Ok, I released moose-language-support@0.3.2 (should be on the Marketplace in a minute)

hugary1995 commented 2 years ago

I can confirm 0.3.2 fixed this bug.