Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119839

qmlls: invalid completions after dots

    XMLWordPrintable

Details

    • ef635e7bc (dev), 29d2153f8 (dev), d06ed7fdd (dev), c5e6c3992 (6.7), 7b26a46ba (6.7), 37a5ac365 (6.7)

    Description

      Currently, qmlls does provide invalid completions while typing after '.'. This does not happen inside the tests for some reason, but it happens while typing:

       

      Item {
         id: root  
         property int good
              Item {
                  property int bad
                  function f() {
                      let x = root.
                      x = x + 1 
                  }
                  // (1) TODO: provides invalid completion `bad`:
                  property int myP: root.b
                  Item { }
          }
      }
      

      If, at the line under (1), you delete `.b` from `root.b` and type in a dot, completion will suggest the properties from the parent instead of root (you can check that by looking for the 'bad' property, and seeing that the 'good' property is not in the suggestion list).

      If you write more letters, for example when you type in `.bad`, then the completions will not be updated and you will continue seeing the suggestion for `bad`.

      Now to the weird part: if you write instead `.good`, then the completions list will be empty (because there is no `good` in the suggestion list)  and then it will start suggesting the `good` property (along with the other properties/methods of root).

      Investigate why that happens:

      do we need to "flush" or "clear" old suggestions away in the LSP, to tell the editor "the completions from before are all wrong, forget about them"?

      Do we suggest the wrong suggestions for the '.' when there is nothing behind the `.`?

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sami.shalayel Sami Shalayel
              sami.shalayel Sami Shalayel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: