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

feat(lsp): allow user defined per lsp on_attach additions #586

Merged
merged 1 commit into from Jun 2, 2022

Conversation

mehalter
Copy link
Member

@mehalter mehalter commented Jun 2, 2022

This allows additions to the on_attach function for specific language servers in the lsp.server-settings table. This was completely incorrectly handled and honestly could be considered just a flat out bug until now. For example, disabling formatting for a single language server can now look like this:

return {
  lsp = {
    ["server-settings"] = {
      html = {
        on_attach = function(client, bufnr)
          client.resolved_capabilities.document_formatting = false
        end
      }
    }
  }
}

Also makes it easier to disable our custom on_attach for specific languages, like if a user wants to use tsserver formatting they can just do this:

return {
  lsp = {
    ["server-settings"] = {
      tsserver = {
        on_attach = function() end
      }
    }
  }
}

@mehalter mehalter added the enhancement New feature or request label Jun 2, 2022
@mehalter mehalter requested a review from kabinspace June 2, 2022 18:18
@mehalter mehalter self-assigned this Jun 2, 2022
@mehalter mehalter force-pushed the lsp_server_on_attach branch 2 times, most recently from 8fca3d5 to f3b93cb Compare June 2, 2022 20:14
@mehalter mehalter mentioned this pull request Jun 2, 2022
@mehalter mehalter merged commit e13fa0f into main Jun 2, 2022
@mehalter mehalter deleted the lsp_server_on_attach branch June 2, 2022 20:55
@mehalter mehalter mentioned this pull request Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant