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

Monolithic structure, multiple project settings #32693

Open
thetrompf opened this issue Aug 17, 2017 · 42 comments
Open

Monolithic structure, multiple project settings #32693

thetrompf opened this issue Aug 17, 2017 · 42 comments
Assignees
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality
Milestone

Comments

@thetrompf
Copy link

I was wondering if it is possible for VSCode to pick up on multiple .vscode/settings.json

For instance if you are working in an monolithic environment with multiple smaller projects inside it, and each have their own .vscode/settings.json.
Can VSCode pickup on that, and apply the settings from the smaller projects .vscode/settings.json to their subtree and descendant files?

monolithic-project/
├── small-project1/
│   ├── .vsocde
│   │   └── settings.json
│   └── src/
│       └── index.ts
└── small-project2/
    ├── .vsocde
    │   └── settings.json
    └── src/
        └── index.ts              

Wanted effect:
monolithic-project/small-project1/.vscode/settings.json applies to monolithic-project/small-project1 and all descendant files.
monolithic-project/small-project2/.vscode/settings.json applies to monolithic-project/small-project2 and all descendant files.

@vscodebot vscodebot bot added the workbench label Aug 17, 2017
@thetrompf thetrompf changed the title Monolithic structure, multiple projects settings. Monolithic structure, multiple project settings. Aug 17, 2017
@thetrompf thetrompf changed the title Monolithic structure, multiple project settings. Monolithic structure, multiple project settings Aug 17, 2017
@sandy081
Copy link
Member

sandy081 commented Aug 21, 2017

Supporting folder settings at any level is a good idea and is similar to editor config.

FYI Currently we are working on a multi root workspace where you can have multiple root folders. In this case settings under each root folder are applied to the resources under the respective folder (just as you mentioned). But all such folders should be root folders (small-project1, small-project2). This feature is available only in insiders. See #28344 for more details.

Please close this request, if multi root workspaces full fill your requirements

@sandy081 sandy081 added feature-request Request for new features or functionality settings-editor VS Code settings editor issues labels Aug 21, 2017
@thetrompf
Copy link
Author

thetrompf commented Aug 22, 2017 via email

@bpasero bpasero removed the workbench label Nov 16, 2017
@sandy081 sandy081 added config VS Code configuration, set up issues and removed settings-editor VS Code settings editor issues labels Nov 17, 2017
@sandy081 sandy081 added this to the Backlog milestone Nov 17, 2017
@DanTup
Copy link
Contributor

DanTup commented Mar 9, 2018

I raised a case that I think covers this (but also a bit more) at #45399. This extends to more than just settings, but also launch configs/etc.

@thetrompf
Copy link
Author

You're right it just extends to multiple .vscode directories. Settings, launch, tasks and etc.

@shridharkalagi
Copy link

I have landed in a similar situation. Is this resolved in the latest version?

@thetrompf
Copy link
Author

thetrompf commented Jan 22, 2019 via email

@shridharkalagi
Copy link

Is this in the backlog of issues to be fixed? Any workaround till then?

@xujintao
Copy link

xujintao commented Aug 8, 2019

@DanTup
after #45399 then #45470
So, do vscode support mono or not? if not, which issue should be followed?

@DanTup
Copy link
Contributor

DanTup commented Aug 8, 2019

@xujintao it depends a lot on your project structure and language. For Dart/Flutter, it's a little wonky without #45470, but we have made some improvements to find our own project roots instead of using multi-root workspaces.

@memark
Copy link

memark commented Aug 29, 2020

Any update on this? Still would be a really helpful feature!

@scgbear
Copy link
Member

scgbear commented Feb 3, 2021

Internal Tracking devdivcsef 412378

@DibyodyutiMondal
Copy link

I too would love to see this feature implemented. My use case is for javascript/typescript.

As a simple example, I have an angular project web-client, a server-side project app-engine; both of which depend on project models, which follow the folder structure:

- apps
  - web-client
  - app-engine
- libs
  - models
- ... other stuff

app-engine and models target ESM, not commonjs.

Now, ESM requires the imports end with the file extension. So to run the server, it must use the file extension, and the same goes for models because it is going to be used by app-engine. However, web-client is built by the angular cli, and I am not sure if it's the cli or webpack, but the build process fails if I use file extensions inside web-client. Since models is a package (i.e. it has a package.json file with "type": "module"), angular does not complain about file extensions inside models.

Thus, I need the following vscode settings inside app-engine and models, but not in web-client

  "javascript.preferences.importModuleSpecifierEnding": "js",
  "typescript.preferences.importModuleSpecifierEnding": "js"

Having folder-level settings.json work the same way package.json or tsconfig.json works, would be wonderful.

Workaround:
Currently, I am having to exclude the individual project folders in the root .vscode/settings.json, and adding them as workspace folders in the .code-workspace file, then adding the folder-level .vscode/settings.json in order to get what I need.

@superherointj
Copy link

I miss this.

I also miss extensions being local to projects, specially in a monorepo, extensions should be turned on according to projects and not having all of them enabled by simultaneously.

@hyrious
Copy link

hyrious commented Nov 5, 2022

I also miss extensions being local to projects

@superherointj You can already do that in workspace, just goto the extension page and click "Enable (Workspace)"

image

@mathiasayivor
Copy link

So, it's still 2023 and this feature is still pending for an editor, like vs code? Wow. Just wow.

@thetrompf
Copy link
Author

You could ask for a refund.

@adonig
Copy link

adonig commented Mar 18, 2023

Can someone please ask ChatGPT to fix this issue?

@superherointj
Copy link

Please avoid noise (push back and joke). It notifies subscribers. Like this is important. And actually isn't.
Now this message itself is going to create more notifications. Hopefully the last one of noise? Please don't answer.

@starball5
Copy link

Meta notes:

Possibly/loosely related:

Related (some loosely) on Stack Overflow:

@datvm
Copy link

datvm commented Oct 2, 2023

I want to specify another usecase for this is the glob based properties like Readonly. For example, I want all js/** files of all projects in a folder only to be readonly (because they are generated by TypeScript).

Now my folder would look like this:

Root
|-- Project 1
    |-- js <-- files in this folder should be readonly
|-- Project 2
    |-- js <-- files in this folder should be readonly
|-- .vscode <-- config file in here

When working, I would open Project1 or Project2 folders, not Root. So in this case, I would like VS Code to look up the parent folders for a .vscode for settings. The blob should also be applied to that project folder, not Root btw.

@eliliam
Copy link

eliliam commented Oct 25, 2023

This has been open for 6 years now, can we please get some support here? Even if it's only in the insiders or nightly builds to start. This is a crucial feature that nearly every other tool supports.

VS Code is the foundation for most web development environments and is used by teams across many types of projects. Having support for monorepos and opening subdirectories instead of the root of the monorepo(which often is very large and uses more resources than you need) would allow for a truly amazing experience standardizing settings across a monorepo for teams of developers.

Would something like this be possible do do in an extension if Microsoft doesn't want to add this for whatever reason?

@georglauterbach
Copy link

This is also a blocker for Rust projects where a workspace is used and some workspace members have different compilation targets. Setting "rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf" in the global settings.json is not possible because it overwrites the target for all workspace members..

@photex
Copy link

photex commented Nov 15, 2023

The vscode multi-root workspaces seem to achieve only the most minimal parts needed of a proper workspace; in which you combine multiple paths and give them a single governing settings object.
What would be the most useful and would be wonderful to see instead, is a clear declaration of paths (including folder exclusions) and the ability to override settings based on these root folders in addition to common workspace level settings ideally in the single root level *.code-workspace (but I'd be ok using multiple .vscode subdirectories too).


I'll give an example of why this is useful for myself and my team. I work in automotive and a lot of our code that deals with various CAN vehicle protocols have some associated test suites that exercise the state machines we either implement or interact with.
We run these tests on the desktop, but they're using libraries that are also built into the application that we flash to the devices. We also have some desktop tools that listen to CAN messages and reports diagnostics and even some HIL tests that we can run using cmake workflow presets.

To facilitate this a lot of code is shared and it simply isn't an option to break it into a bunch of tiny repos with separate builds. The workflow we have with CMake, Cmake presets and our toolchains all living in a single cohesive depot workspace saves us enormous amounts of time and energy. And probably the best part, is that the opportunity cost of properly modularizing code is almost null.

Our depot is a single Cmake build which targets embedded and desktop builds using an extensive library of cmake presets which provide concrete toolchain configurations and properly configure helpful things like build caches.
Some subfolders are not part of the desktop configuration, and likewise some are not part of the embedded configurations.
The resulting compilation databases shouldn't be stitched together because you'll have duplicate entries with very different toolchains and compilation flags.

To echo what @georglauterbach also said, this isn't unique to C++ related projects, and we're also exploring some of the new possibilities with Rust and so we'd love to be able to lean on a proper *.code-workspace for that as well.

@tiborrr
Copy link

tiborrr commented Jan 3, 2024

Just found this issue. Here you have another great usecase:

microsoft/vscode-black-formatter#407

@fjmacagno
Copy link

Bump, this would be really helpful.

@onlywei
Copy link

onlywei commented Jul 9, 2024

I see a lot of issues that were closed as duplicates of this one, but I don't think the original post in 2017 actually captures some of those closed issues. For instance, does this issue capture the following use case?

.git/
.vscode/
  settings.json
subfolder1/
  subsubfolderA/ <-- open VSCode here, expect settings from root of repo to load

@starball5
Copy link

@onlywei #32693 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests