Skip to content

Autocompletion always completing keywords after . (VS 2019) #11145

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

Open
keldor314 opened this issue Feb 25, 2021 · 3 comments
Open

Autocompletion always completing keywords after . (VS 2019) #11145

keldor314 opened this issue Feb 25, 2021 · 3 comments
Labels
Area-LangService-AutoComplete autocomplete/intellisense Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@keldor314
Copy link

Autocompletion seems to want to trigger after I hit the period key, but only if it autocompletes a keyword. An example is if I'm typing a type definition something like so:

type foo ()=
   member s.

At which point, the autocomplete "helpfully" changes it to

type foo () =
  member static.

Since it thinks it the "s" should turn into "static"

As far as I can tell, this only happens if it can change it specifically into a keyword, as opposed to a type name or variable name.

This specific case is particularly annoying since using "s" as the self identifier is canonical F#, and I can't even think of any cases where "static." could ever be valid syntax, but changing "y." to "yield." is also plaguing me as I'm trying to write math libraries where x and y are typical variable names for complex numbers or quaternions (so my intention would be something like y.i or y.r)

Does trying to autocomplete keywords after . is typed make sense under any circumstances whatsoever? I can't think of any valid syntax where a . immediately follows a keyword.

@charlesroddie
Copy link
Contributor

Duplicate of #6695 (comment)

I have the Ctrl-Alt-Space combo written on the wall by my compter because the setting reverts regularly.

@cartermp cartermp added Area-FCS Area-LangService-API Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. labels Mar 3, 2021
@cartermp
Copy link
Contributor

cartermp commented Mar 3, 2021

I will keep this open and track it separately here, since there is a root problem: there should be no triggering of a completion list here in the first place. The behavior of . completing it is just a behavior native to VS, and it absolutely should complete a completion item if that setting is on. But there should absolutely be no triggering of completion in this case at all.

@dsyme
Copy link
Contributor

dsyme commented Oct 30, 2021

@cartermp You wrote this:

The behavior of . completing it is just a behavior native to VS, and it absolutely should complete a completion item if that setting is on. But there should absolutely be no triggering of completion in this case at all.

This doesn't seem to be the case - see #12318. We are expressly avoiding commiting completion on . for all non-keyword completions, see https://github.com/dotnet/fsharp/pull/12318/files#diff-fb1a1ef5b7be2c8c60d8f92be436ee8c89a1cc372f71b740d09c0e054df20b85R59. The problem is that we're not doing that for keyword completions, per #12318

This can be seen in the repro for the difference between

  • typing s then selecting string then hitting . (no completion)
  • typing s then selecting static then hitting . (completion)

So keyword completions shouldn't be completing on . and other characters, just as other completions don't commit on those characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-AutoComplete autocomplete/intellisense Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Status: New
Development

No branches or pull requests

4 participants