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

New config to turn off TypeScript autocomplete suggestions #58011

Merged
merged 3 commits into from Sep 10, 2018

Conversation

Projects
None yet
6 participants
@davnicwil
Contributor

davnicwil commented Sep 5, 2018

A new typescript.suggestions.enabled config (boolean, default true)

Setting false removes all autocomplete suggestions provided by typescript via the built-in typescript-language-features extension.

The default is true, so that existing behaviour remains the same.

Why?

The typescript autocomplete suggestions are a great feature, when you're working on a typescript project.

image

But when you're working on a flow project using the flow-for-vscode plugin, it provides its own autocomplete suggestions via flow. So your autocomplete gets littered with duplicate suggestions coming from both typescript and flow:

image

What this config does is turns off the typescript suggestions, so you get this instead:

image

I.e. no duplicates, only theflow-for-vscode suggestions. Problem solved.

Prior Issues

There have been a few existing issues raised about this problem both on the flow-for-vscode project and here.

Quoting from the third issue there

We have requests to support disabling all TS functionality. Instead of introducing a setting we should allow disabling built in extensions.

So, what am I doing submitting a PR for a setting? Why doesn't #17068 solve the problem?

Well, the thing is, as I commented here, I don't want to disable all of the javascript & typescript extension. I only want to disable the autocomplete suggestions coming from typescript.

Why? Because the extension also provides some other functionality I can't do without.

  • Cmd+click to imports and variable definitions
  • Name based suggestions in js
  • There may be others (I haven't spent enough time with the extension turned off to find them all!)

It's actually worse to lose this functionality, than to just deal with the duplicates in autocomplete. So this is definitely not a solution to the problem.

I really believe vscode needs the ability to turn off typescript autocomplete, specifically. Flow support provided via the awesome flow-for-vscode combined with all of the rest vscode's great feature set makes it a really good editor for flow projects, but this autocomplete issue is one of the last remaining obvious and annoying things that just get in the way of productivity. And it's so easy to fix!


Just a note, my PR here is just a reference implementation to highlight how simple this change could possibly be to land. I have tested it in real usage and with my own workflow it is working well, but I may have missed some corner cases / features I don't use. I'm more than happy to fix anything that's pointed out myself, or just to have this completely redone by someone who knows more in depth about how this could be done better if my implementation is too simple/naive. I just want this feature in mainline vscode! And I know a lot of other people do too.

@msftclas

This comment has been minimized.

Show comment
Hide comment
@msftclas

msftclas Sep 5, 2018

CLA assistant check
All CLA requirements met.

msftclas commented Sep 5, 2018

CLA assistant check
All CLA requirements met.

@davnicwil davnicwil referenced this pull request Sep 5, 2018

Closed

IntelliSense problems #97

@mjbvz mjbvz self-assigned this Sep 5, 2018

@mjbvz

This comment has been minimized.

Show comment
Hide comment
@mjbvz

mjbvz Sep 5, 2018

Contributor

The idea behind this PR seems fine. However I believe this new setting should disable all completions from js/ts, including name based suggestions. This is what similar settings like javascript.format.enable and javascript.validate.enable do, as it lets another extension fully take over responsibility for these areas

Also keep in mind that we make no guarantees that our built-in js/ts support will work at all for flow code (and operations like formatting or refactoring may even break flow code). That's why we recommend disabling the built-in js/ts support if you are using the flow extension. The flow extension really needs to implement these tooling feature on their side to ensure they work properly

Contributor

mjbvz commented Sep 5, 2018

The idea behind this PR seems fine. However I believe this new setting should disable all completions from js/ts, including name based suggestions. This is what similar settings like javascript.format.enable and javascript.validate.enable do, as it lets another extension fully take over responsibility for these areas

Also keep in mind that we make no guarantees that our built-in js/ts support will work at all for flow code (and operations like formatting or refactoring may even break flow code). That's why we recommend disabling the built-in js/ts support if you are using the flow extension. The flow extension really needs to implement these tooling feature on their side to ensure they work properly

@davnicwil

This comment has been minimized.

Show comment
Hide comment
@davnicwil

davnicwil Sep 5, 2018

Contributor

Great. You are right about the approach of having extensions take over full responsibility for things being better. But that might take a while and this config change is pretty simple (and would also be simple to remove later) and solves the problem today.

I will remove the distinction between name suggestions / others, and just have it disable every suggestion. You make a good point that it would break from the convention a bit.

Contributor

davnicwil commented Sep 5, 2018

Great. You are right about the approach of having extensions take over full responsibility for things being better. But that might take a while and this config change is pretty simple (and would also be simple to remove later) and solves the problem today.

I will remove the distinction between name suggestions / others, and just have it disable every suggestion. You make a good point that it would break from the convention a bit.

@svipben

This comment has been minimized.

Show comment
Hide comment
@svipben

svipben Sep 6, 2018

Contributor

You can now manage built-in extensions: https://code.visualstudio.com/updates/v1_21#_extensions which will disable TS/JS autocomplete and you can easily use flow in VS Code, so why this is needed? Or I'm missing something?

Contributor

svipben commented Sep 6, 2018

You can now manage built-in extensions: https://code.visualstudio.com/updates/v1_21#_extensions which will disable TS/JS autocomplete and you can easily use flow in VS Code, so why this is needed? Or I'm missing something?

@noppa

This comment has been minimized.

Show comment
Hide comment
@noppa

noppa Sep 6, 2018

If you disable the builtin "TypeScript and JavaScript Language Features" extension, you'll loose a whole lot of other things than autocomplete suggestions, too. JSDoc completion, symbol renaming etc.
Although @mjbvz does make a valid point about those being the responsibility of the Flow extension in this case.

noppa commented Sep 6, 2018

If you disable the builtin "TypeScript and JavaScript Language Features" extension, you'll loose a whole lot of other things than autocomplete suggestions, too. JSDoc completion, symbol renaming etc.
Although @mjbvz does make a valid point about those being the responsibility of the Flow extension in this case.

@svipben

This comment has been minimized.

Show comment
Hide comment
@svipben

svipben Sep 6, 2018

Contributor

@noppa Thanks, good to know. Also, I totally agree with @mjbvz it is Flow extension responsibility, but as I know they actually don't care and to be honest TypeScript is way better since it works way faster, you get refactoring for file names, paths, etc. If you really want good support for Flow and to use VS Code you should create your own extension.

Maybe it makes sense to control built-in JS/TS language features instead of disabling them all, like checkboxes with variuos features like renaming, jsdoc completion, linting, autocompletion, etc. I believe it would be good feature request.

Contributor

svipben commented Sep 6, 2018

@noppa Thanks, good to know. Also, I totally agree with @mjbvz it is Flow extension responsibility, but as I know they actually don't care and to be honest TypeScript is way better since it works way faster, you get refactoring for file names, paths, etc. If you really want good support for Flow and to use VS Code you should create your own extension.

Maybe it makes sense to control built-in JS/TS language features instead of disabling them all, like checkboxes with variuos features like renaming, jsdoc completion, linting, autocompletion, etc. I believe it would be good feature request.

@davnicwil

This comment has been minimized.

Show comment
Hide comment
@davnicwil

davnicwil Sep 6, 2018

Contributor

@svipben

So why this is needed?

That question is answered in the PR description in the section under So, what am I doing submitting a PR for a setting? Why doesn't #17068 solve the problem?

If you really want good support for Flow and to use VS Code you should create your own extension.

I like the flow-for-vscode extension, it's working well for me. I just want to remove one annoying thing: the duplicate autocomplete suggestions.

Maybe it makes sense to control built-in JS/TS language features instead of disabling them all

This is a simple change that solves a specific problem. That might be a good feature for that other people need for broader usecases but this PR is just focused on disabling JS/TS autocomplete suggestions for a nicer experience working with flow and flow-for-vscode. I don't think we should complicate things.

Contributor

davnicwil commented Sep 6, 2018

@svipben

So why this is needed?

That question is answered in the PR description in the section under So, what am I doing submitting a PR for a setting? Why doesn't #17068 solve the problem?

If you really want good support for Flow and to use VS Code you should create your own extension.

I like the flow-for-vscode extension, it's working well for me. I just want to remove one annoying thing: the duplicate autocomplete suggestions.

Maybe it makes sense to control built-in JS/TS language features instead of disabling them all

This is a simple change that solves a specific problem. That might be a good feature for that other people need for broader usecases but this PR is just focused on disabling JS/TS autocomplete suggestions for a nicer experience working with flow and flow-for-vscode. I don't think we should complicate things.

@mjbvz mjbvz merged commit b9dbeb9 into Microsoft:master Sep 10, 2018

2 checks passed

VS Code #20180905.105 succeeded with issues
Details
license/cla All CLA requirements met.
Details
@mjbvz

This comment has been minimized.

Show comment
Hide comment
@mjbvz

mjbvz Sep 10, 2018

Contributor

Just a heads up: I'm renaming this setting to typescript.suggest.enabled and javascript.suggest.enabled to be consistent with our other extensions

Contributor

mjbvz commented Sep 10, 2018

Just a heads up: I'm renaming this setting to typescript.suggest.enabled and javascript.suggest.enabled to be consistent with our other extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment