Skip to content
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

Improve IntelliSense support when using VS Code #8043

Merged
merged 1 commit into from
Jul 20, 2018
Merged

Conversation

noisysocks
Copy link
Member

Improves IntelliSense support in Visual Studio Code by providing a jsconfig.json file that correctly maps @wordpress/ paths to their source location.

This lets developers cmd+click on symbols to navigate to where they're defined:

navigation

It also improves the hints shown when using symbols imported from @wordpress/ paths:

hints

Improve IntelliSense support in Visual Studio Code by providing a
jsconfig.json file that correctly maps @wordpress/ paths.
@noisysocks noisysocks added the [Type] Build Tooling Issues or PRs related to build tooling label Jul 19, 2018
@noisysocks noisysocks requested a review from a team July 19, 2018 03:48
"coverage",
"node_modules",
"test/e2e/test-plugins",
"vendor"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I borrowed these excludes from .eslintignore—not sure how up to date they are. From what I understand reading the docs, VS Code just recommends that you exclude directories with lots of irrelevant source files e.g. build and node_modules.

@gziolo
Copy link
Member

gziolo commented Jul 19, 2018

Nice stuff. I'm wondering if it should be a local file which you add to the list of ignored files using your local bash configuration (unless it isn't specific only to VS Code).

@ntwb
Copy link
Member

ntwb commented Jul 19, 2018

Agreed, it should be a local file added to your local Git .gitignore file

Edit: To expand the reasons on why this shouldn't be in the repo, a similar request was made for core to add PHPStorm's .idea in WP's .gitignore. The discussion around this was should we add Netbeans, Sublime Text, and Atom etc specific options and configs for all the editors and IDEs to core, and it was quickly decided that that should not occur.

I've considered in the past having a section in the core handbook that would highlight these types of enhancements for Editor/IDEs, the eslint-config-wordpress has one such of these documents on how best to setup VS Code for ESLint and WordPress development.

@noisysocks
Copy link
Member Author

For what it's worth, Calypso has a jsconfig.json which is very useful.

Agreed, it should be a local file added to your local Git .gitignore file

I don't think adding jsconfig.json to .gitignore makes sense because it's not automatically generated like .idea is. It contains information about the JavaScript project, not editor configuration settings.

unless it isn't specific only to VS Code

It's not specific to VS Code in that any tool is free to parse it 😉 For example, Sourcegraph uses jsconfig.json to power JavaScript hinting in their Atom plugin and Sublime Text plugin.

@noisysocks
Copy link
Member Author

Ask yourself: which option does more good for the world?

  1. We add jsconfig.json. VS Code users get a useful productivity gain for free. Other developers go on about their days and don't notice a thing.
  2. We don't add jsconfig.json. A few VS Code users spend the necessary 1-2 hours as I did learning about jsconfig.json and setting it up. Most VS Code developers go on about their days and don't know what they're missing out on. Other developers go on about their days and don't notice a thing.

@pento
Copy link
Member

pento commented Jul 20, 2018

I'm in two minds about this.

On the one hand, I'm not wild about us adding IDE-specific stuff to Core. It could pretty easily get out of hand, if everyone wants the config for their specific editor added.

On the other hand, we have the .editorconfig file, but the Editorconfig spec doesn't cover a bunch of useful stuff, and it barely moves, whereas IDE maintainers are far more likely to keep their stuff moving.

It's unfortunately that a good, global editor config standard hasn't really emerged, that would make the decision a bunch easier.

I'm inclined to put this in Gutenberg for now, and look at how we can practically allow IDE configs in Core. Perhaps base it on current popularity or something.

@ntwb
Copy link
Member

ntwb commented Jul 20, 2018

I didn't expect Notepad++ to rank so highly there...

Thanks @noisysocks, let's do it under the guise that jsconfig.json is not Editor/IDE specific 😉

@noisysocks noisysocks merged commit a0724b7 into master Jul 20, 2018
@noisysocks noisysocks deleted the add/jsconfig.json branch July 20, 2018 03:15
@noisysocks
Copy link
Member Author

It's unfortunately that a good, global editor config standard hasn't really emerged, that would make the decision a bunch easier.

“Imagine a world with one global editor config standard.”

iur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants