question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move Configs to Project Templates

See original GitHub issue

Today, several of the extensions for VS Code write or update various configuration files from the extension. Examples are the jsconfig.json, .eslintrc from LWC, changing values in .vscode/settings.json from the core extension and LWC.

I find this pattern of having the extensions write config files to be jarring and unfamiliar. I can’t think of any other tools that do this. We have also seen problems (https://github.com/forcedotcom/salesforcedx-vscode/issues/1049) from customers when we update these files - specifically for local settings.

Instead of writing configuration files and settings from extensions we should include those files and settings in the project or other templates and the extensions should check for their presence and provide proper warnings when they are not included.

We already have done most of this work with the updated project create template. It now will include the following out of the box:

β”œβ”€β”€ README.md
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .forceignore
β”œβ”€β”€ .prettierrc
β”œβ”€β”€ .prettierignore
β”œβ”€β”€ .vscode
β”‚   β”œβ”€β”€ extensions.json
β”‚   β”œβ”€β”€ settings.json
β”‚   └── launch.json
β”œβ”€β”€ config
β”‚   └── project-scratch-def.json
β”œβ”€β”€ force-app
β”‚   └── main
β”‚       └── default
β”‚           β”œβ”€β”€ applications
β”‚           β”œβ”€β”€ aura
β”‚           β”œβ”€β”€ classes
β”‚           β”œβ”€β”€ contentassets
β”‚           β”œβ”€β”€ flexipages
β”‚           β”œβ”€β”€ layouts
β”‚           β”œβ”€β”€ lwc
β”‚           β”‚  └── .eslintrc.json
β”‚           β”œβ”€β”€ objects
β”‚           β”œβ”€β”€ permissionsets
β”‚           β”œβ”€β”€ staticresources
β”‚           β”œβ”€β”€ tabs
β”‚           └── triggers
└── sfdx-project.json

So you will already get most of what you need to have configured in an extension in the default template. If we added a few things such as the jsconfig.json file then we could eliminate the need for extensions to write files/settings individually.

This does bring up the problem of what happens if the settings/config files change. We have in the past discussed the idea of a CLI command called force:project:update that would update your project files to the latest version. This is useful for changes to the schema of the sfdx-project.json or updating/adding config files with new settings.

Additionally, there could be functionality in the command fource:project:update --check that does a check of your projects version settings. With this command, we could do a single check that your project was in the right state from the core VS Code extension - one place to manage all the configs and settings. We would then prompt people to upgrade their project if needed. This would remove the need for every extension to implement this themselves.

Additionally, we need to put local user configurations in a new place outside of .vscode/settings.json. That file is meant to be used for project settings, not user settings. If we do have local, extension specific settings we should adopt something like .sfdx/settings.json that is not checked into source control.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ntottencommented, Apr 25, 2019

Sorry, I should have been more clear. This issue isn’t actually about having them in the template - it is about removing the behavior of the extension from writing them at all. So the first step was adding them to the template. Now we need to make it so the extension does not write these files at all but rather just checks to make sure they exist and provide so information on how to create them.

0reactions
lcamposcommented, Apr 25, 2019

Got it, thanks for clarifying πŸ‘

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need to understand how to move a template to a project?
What it can do is "use the same config as another project" - this bypasses all the templates and sets up the new...
Read more >
Configure a Project Template - Procore Support
To find the project name, navigate to the Portfolio tool and locate the desired project in the Projects list. Include the Name value....
Read more >
Migrating a project to a different process template - IBM
Press Ctrl+a to select all. Right-click and click Copy. In the existing project on the Process Configuration Source page, right-click and click Paste....
Read more >
Project template configuration
Navigate to Project Administration > Settings > Template Config to display the Project Template Configuration list. Each item in this list has:.
Read more >
Build Configuration Template - TeamCity On-Premises
On moving a build configuration/project, the logic checks all templates to which the build configuration is attached.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found