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

Allow to extend the client, make initialize params and request protected? #33

Closed
krassowski opened this issue Feb 3, 2025 · 1 comment · Fixed by #34
Closed

Allow to extend the client, make initialize params and request protected? #33

krassowski opened this issue Feb 3, 2025 · 1 comment · Fixed by #34

Comments

@krassowski
Copy link

This library would be a bit more useful if it allowed to configure language servers or otherwise extend its functionality.

Currently it is not possible to cleanly override the behaviour of the LanguageServerClient because:

  • the initialize options are hard-coded in initialize() method; while this method is public and can be overridden by copy-pasting,
  • the request is marked as private which means that we need to use @ts-ignore

Would you consider a PR which:

  • changes request to protected so that it can be used in subclasses
    private request<K extends keyof LSPRequestMap>(
  • moves the hard-coded initialize options to a protected method?
    public async initialize() {
    const { capabilities } = await this.request("initialize", {
    capabilities: {
    textDocument: {
    hover: {
    dynamicRegistration: true,
    contentFormat: ["plaintext", "markdown"],
    },
    moniker: {},
    synchronization: {
    dynamicRegistration: true,
    willSave: false,
    didSave: false,
    willSaveWaitUntil: false,
    },
    completion: {
    dynamicRegistration: true,
    completionItem: {
    snippetSupport: false,
    commitCharactersSupport: true,
    documentationFormat: ["plaintext", "markdown"],
    deprecatedSupport: false,
    preselectSupport: false,
    },
    contextSupport: false,
    },
    signatureHelp: {
    dynamicRegistration: true,
    signatureInformation: {
    documentationFormat: ["plaintext", "markdown"],
    },
    },
    declaration: {
    dynamicRegistration: true,
    linkSupport: true,
    },
    definition: {
    dynamicRegistration: true,
    linkSupport: true,
    },
    typeDefinition: {
    dynamicRegistration: true,
    linkSupport: true,
    },
    implementation: {
    dynamicRegistration: true,
    linkSupport: true,
    },
    },
    workspace: {
    didChangeConfiguration: {
    dynamicRegistration: true,
    },
    },
    },
    initializationOptions: null,
    processId: null,
    rootUri: this.rootUri,
    workspaceFolders: this.workspaceFolders,
    }, timeout * 3);
@krassowski
Copy link
Author

The same would apply to access to notify method :)

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 a pull request may close this issue.

1 participant