Skip to content

Prototype for #53557 #242680

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Prototype for #53557 #242680

wants to merge 1 commit into from

Conversation

hediet
Copy link
Member

@hediet hediet commented Mar 5, 2025

Prototype for #53557

Allows configurations to use extends to extend a given launch config, e.g.:

  {
	  "name": "Launch VS Code Internal",
	 // ...
  },
  {
	  "name": "Launch VS Code Internal With Observable Debugging",
	  "extends": "Launch VS Code Internal",
	  "env": {
		  "DEBUG_OBSERVABLES": "1"
	  }
  },

This would allow to cleanup the vscode launch.json a bit (also this one), but also enable more advanced configurations .

  • needs more testing
  • needs improved json schema descriptions

Configurations can only extend within one source (e.g. one launch.json file), but I think that is fine.

What do you think of this?

@hediet hediet self-assigned this Mar 5, 2025
@hediet hediet requested a review from connor4312 March 5, 2025 11:32
@roblourens
Copy link
Member

I like it but how can you handle the json schema, is it even possible to validate the second config with the proper type?

@roblourens
Copy link
Member

roblourens commented Mar 5, 2025

I think you could generate a schema which is specific to each launch.json, to say that if you have an entry that is "extends": "Launch VS Code Internal", then that is "type": "chrome", but the other required props are satisfied, etc etc

@hediet
Copy link
Member Author

hediet commented Mar 5, 2025

I think you could generate a schema which is specific to each launch.json, to say that if you have an entry that is "extends": "Launch VS Code Internal", then that is "type": "chrome", but the other required props are satisfied, etc etc

I was also thinking of this, but that sounds very tricky...
But extends is an advanced feature, I don't think json schema is really required here (though it would be nice).

@connor4312
Copy link
Member

JSON schema has native support for $ref, I wonder if we can use that here? However that uses JSON path notation which may be awkward for our launch.json array

@hediet
Copy link
Member Author

hediet commented Mar 11, 2025

JSON schema has native support for $ref, I wonder if we can use that here?

It's tricky, because we want a schema for extended so that deepMerge(base, extended) satisfies the launch config item schema.
Unfortunately, that also depends on the concrete value of base (e.g. its type specifies what properties in extended can be configured)!

@Cyriuz
Copy link

Cyriuz commented Aug 4, 2025

What's the status of this? Would be an amazing feature for increasingly complex launch configs!

@hediet
Copy link
Member Author

hediet commented Aug 5, 2025

@connor4312 can we merge this and see usage? If usage increases we can add json schema support. This enables some use-cases and even deduplicates lots of code in our launch.json.

@hediet hediet marked this pull request as ready for review August 5, 2025 08:33
@hediet hediet force-pushed the hediet/b/forthcoming-tarantula branch from 4b6f56f to f2959e6 Compare August 5, 2025 08:33
@vs-code-engineering vs-code-engineering bot added this to the August 2025 milestone Aug 5, 2025
Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

I would support merging this to try it but I think before it goes to stable we should have a plan to do some kind of validation. I think it would be sad and inconsistent to have no intellisense and no validation for certain configs especially when they are the more complex ones. At the very least, if the json language service can't do it, validate it when you press F5 or something like that.

extendingConfigurations = new Set([name]);
} else {
if (extendingConfigurations.has(name)) {
console.error(`'${name}' is involved in a circular reference. The configuration will be ignored.`);
Copy link
Member

Choose a reason for hiding this comment

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

ILogService?

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

Successfully merging this pull request may close these issues.

4 participants