You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a follow-up to the work done in #14594 there are still a couple situations that still don't offer you a completions if your preface already includes an opened backtick.
Minimized code
The first case be illustrated by the following:
val`foo-bar`=3valx= `foo<TAB>
In this situation no completion is offered because the tree that is contained for the current position is Literal(Constant(null)). This seems to come from:
While this works for those two situations it's quite a bit of code for very specific scenarios, and we're probably missing some as well that would also need to be added in. An alternative proposed by @bishaboshahere is as follows:
We had a small discussion and it could be worth trying to make a new Token for an unfinished backticked identifier, which we can then make a valid tree for
The text was updated successfully, but these errors were encountered:
ckipp01
changed the title
Missing backticks for various completions
Missing completions when give a backtick prefix in various positions
Mar 8, 2022
ckipp01
changed the title
Missing completions when give a backtick prefix in various positions
Missing completions when give a backticked prefix in various positions
Mar 8, 2022
Compiler version
3.2.0-RC1-bin-20220307-6dc591a-NIGHTLY-git-6dc591a
Explanation
As a follow-up to the work done in #14594 there are still a couple situations that still don't offer you a completions if your preface already includes an opened backtick.
Minimized code
The first case be illustrated by the following:
In this situation no completion is offered because the tree that is contained for the current position is
Literal(Constant(null))
. This seems to come from:https://github.com/lampepfl/dotty/blob/808c66925daa518294e15419dffec9b7c1490848/compiler/src/dotty/tools/dotc/parsing/Parsers.scala#L386
The second situation is when this is a type instead of a term like so:
The tree that is returned here is
TypeDef(Foo,Ident(<error>))
One final example is:
In this situation
Interactive.patTo
just returns the entire document.Expectation
I'd expect the correct backticked completions to be offered in all 3 of these examples.
Potential solutions
The first way I tried to solve this was by adding specific cases for the first two in various places to catch those trees. For example in:
https://github.com/lampepfl/dotty/blob/808c66925daa518294e15419dffec9b7c1490848/compiler/src/dotty/tools/dotc/interactive/Completion.scala#L61-L79
and
https://github.com/lampepfl/dotty/blob/808c66925daa518294e15419dffec9b7c1490848/compiler/src/dotty/tools/dotc/interactive/Completion.scala#L85-L110
and
https://github.com/lampepfl/dotty/blob/808c66925daa518294e15419dffec9b7c1490848/compiler/src/dotty/tools/dotc/interactive/Completion.scala#L128-L137
While this works for those two situations it's quite a bit of code for very specific scenarios, and we're probably missing some as well that would also need to be added in. An alternative proposed by @bishabosha here is as follows:
The text was updated successfully, but these errors were encountered: