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

[Feature Request] Support multiple tsconfigs in the same repository #488

Closed
Tracked by #968 ...
guidsdo opened this issue Aug 7, 2021 · 8 comments · Fixed by denoland/deno#24345
Closed
Tracked by #968 ...
Assignees

Comments

@guidsdo
Copy link

guidsdo commented Aug 7, 2021

Is your feature request related to a problem? Please describe.

It frustrates me that I can't open one vscode instance for all the projects in my repository. Example of what this repository contains:

client/
  - src/
  - tsconfig.json (containing lib: ["DOM"])
  - import_map.json (containing import aliases like: "shared: ./shared/src/index.ts" and "react: https://cdn. ...")
middleware/
  - src/
  - import_map.json (containing only: "shared: ./shared/src/index.ts")
server/
  - src/
  - import_map.json (containing only: "shared: ./shared/src/index.ts")
shared/
  - src/
- dprint.json
- scripts.json

Currently, this setup isn't supported by vscode and the deno plugin. Why? This is because the plugin only allows me to target one tsconfig in total. This tsconfig then applies for all the projects, which doesn't make sense because only the client projects needs different typings (like DOM etc).

Using workspaces don't fix this because the important Deno settings are applied for all projects and not per workspace.

To have both linting and tsc warnings/errors in Node.js, I've written a tool called mtsc in the past to support this but only out of pure necessity.

Describe the solution you'd like

Supporting these so-called monorepos (or multiple workspaces) is something which is already hard for vscode for Node.js projects, but I would really love it if there could be support for it through the Deno plugin. :-)

One or more of these features that would be really nice:

  • Specify projects and their settings:
projects: [{ 
  "location": "./client", 
  "settings": { 
    "config": "./client/tsconfig.json"
  }
]
  • Autodetect if there is a tsconfig.json that this should be a separate project
  • Allow for a script.json like file that specifies what projects there are and what settings should be set (unsafe, config, linting, etc)
  • ... I don't know, I'm open for better ideas. 😁
@kitsonk
Copy link
Contributor

kitsonk commented Aug 7, 2021

Duplicate of #314

We don't want to put in a whole configuration infrastructure that effectively breaks with the built in capabilities of vscode (or other editors). There is quite a bit of conversation at the end of #314 about why it is problematic.

Using workspaces don't fix this because the important Deno settings are applied for all projects and not per workspace.

The plan is to move more to be configured per workspace. Which ones are "missing" for you?

@kitsonk kitsonk added the duplicate This issue or pull request already exists label Aug 7, 2021
@guidsdo
Copy link
Author

guidsdo commented Aug 7, 2021

Thank you for your quick response!
Well, I couldn't get a tsconfig.json and import_map.json working per workspace. Do you have an example of this working or don't I understand your answer?

@guidsdo
Copy link
Author

guidsdo commented Aug 8, 2021

Ah we do understand eachother correctly. I'm missing the following settings for a workspace:

  • tsconfig.json (wjhich is called deno.config)
  • import_map.json (which is called deno.importMap)
  • unstable ("deno.unstable")

If you want more input, please let me know

@johnspurlock
Copy link

@guidsdo have you tried multi-root workspaces? This is vscode's way of isolating different project settings (per-root) within a single vscode workspace.

The deno plugin actually supports overriding some project config at the individual root level, but unfortunately deno.config is not one of the settings you can override.

Allowing separate deno.config per project root would solve this problem nicely, but I wonder if it's a limitation of the language server?

@guidsdo
Copy link
Author

guidsdo commented Aug 25, 2021

@johnspurlock yes I've tried that and the whole point of this request is to support multiple deno.configs, be it per workspace or combined.

I can't imagine it being a limitation of the language server, since you can actually setup a language client per workspace. Currently I'm trying to set this up in a demo plugin with the little time I have available currently.

@kitsonk
Copy link
Contributor

kitsonk commented Aug 25, 2021

I can't imagine it being a limitation of the language server, since you can actually setup a language client per workspace.

In multi-root workspaces, there is only one language server and one client. Basically they are "per window". So it is a limitation of the language server.

@nayeemrmn
Copy link
Collaborator

You can now have many deno.json scopes with different import maps. But the TS config is still only acquired from the deno.json at the workspace root.

@nayeemrmn nayeemrmn changed the title [Feature Request] Support multiple types of projects in the same repository [Feature Request] Support multiple tsconfigs in the same repository Jun 19, 2024
@nayeemrmn nayeemrmn self-assigned this Jun 21, 2024
@guidsdo
Copy link
Author

guidsdo commented Jun 26, 2024

@nayeemrmn amazing, thank you! I totally forgot about this request, but now this gives me energy to try it again :-)

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

Successfully merging a pull request may close this issue.

5 participants