Skip to content

[typespec-vscode] Allow lsp disable running emitters #7576

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 63 commits into
base: main
Choose a base branch
from

Conversation

mzhongl524
Copy link
Member

Fix: #7305

Allow lsp disable running emitters

@mzhongl524 mzhongl524 added the ide Issues for VS, VSCode, Monaco, etc. label Jun 6, 2025
@mzhongl524 mzhongl524 marked this pull request as draft June 6, 2025 03:02
Copy link
Contributor

github-actions bot commented Jun 6, 2025

All changed packages have been documented.

  • @typespec/compiler
  • typespec-vscode
Show changes

@typespec/compiler - feature ✏️

Allow LSP to run emitters configured by users in the settings

typespec-vscode - feature ✏️

Allow LSP to run emitters configured by users in the settings

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jun 6, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@mzhongl524 mzhongl524 marked this pull request as ready for review June 11, 2025 07:51
@mzhongl524
Copy link
Member Author

@timotheeguerin please help review

createClientConfigProvider,
} from "../../src/server/client-config-provider.js";

describe("compiler: server: client-config-provider", () => {
Copy link
Member

Choose a reason for hiding this comment

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

remove top level describe

"typespec.lsp.emit": {
"type": "array",
"default": null,
"description": "List of emitters that should be included in compilation in typespec LSP server when supporting LSP related functionalities.\n\nExample:\n\"typespec.lsp.emit\": [\n \"@typespec/openapi3\"\n]",
Copy link
Member

Choose a reason for hiding this comment

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

Should describe that this will just run the emitter in dry mode for emitters that support it even if you enable it

* @param defaultValue Default value if not found
* @returns The configuration value or default
*/
get<T>(section: string): T | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to not have the known config itself be typed instead of having this be done at the point of usage?

// If emit is set in additionalOptions, use this setting first
// otherwise, obtain the `typespec.lsp.emit` configuration from clientConfigsProvider
if (additionalOptions?.emit === undefined) {
const configEmits = clientConfigsProvider?.get<string[]>("typespec.lsp.emit");
Copy link
Member

Choose a reason for hiding this comment

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

clientConfigsProvider?.config?.lsp?.emit

I think would be a simpler experience

- typespec-vscode
---

Allow LSP to run emitters configured by users in the settings
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Allow LSP to run emitters configured by users in the settings
Allow LSP to configure which emitters to include for live checks


// Verify configuration was fetched and applied
strictEqual(mockConnection.workspace.getConfiguration.mock.calls.length, 1);
strictEqual(mockConnection.workspace.getConfiguration.mock.calls[0]?.[0], "typespec");
Copy link
Member

Choose a reason for hiding this comment

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

you can use instead expect().toHaveBeenCalled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ide Issues for VS, VSCode, Monaco, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants