lsp-wrapper.lua 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. local lsp_wrapper = {}
  2. -- buf
  3. function lsp_wrapper.add_to_workspace_folder()
  4. vim.lsp.buf.add_workspace_folder()
  5. end
  6. function lsp_wrapper.clear_references()
  7. vim.lsp.buf.clear_references()
  8. end
  9. function lsp_wrapper.code_action()
  10. vim.lsp.buf.code_action()
  11. end
  12. function lsp_wrapper.declaration()
  13. vim.lsp.buf.declaration()
  14. vim.lsp.buf.clear_references()
  15. end
  16. function lsp_wrapper.definition()
  17. vim.lsp.buf.definition()
  18. vim.lsp.buf.clear_references()
  19. end
  20. function lsp_wrapper.document_highlight()
  21. vim.lsp.buf.document_highlight()
  22. end
  23. function lsp_wrapper.document_symbol()
  24. vim.lsp.buf.document_symbol()
  25. end
  26. function lsp_wrapper.formatting()
  27. vim.lsp.buf.formatting()
  28. end
  29. function lsp_wrapper.formatting_sync()
  30. vim.lsp.buf.formatting_sync()
  31. end
  32. function lsp_wrapper.hover()
  33. vim.lsp.buf.hover()
  34. end
  35. function lsp_wrapper.implementation()
  36. vim.lsp.buf.implementation()
  37. end
  38. function lsp_wrapper.incoming_calls()
  39. vim.lsp.buf.incoming_calls()
  40. end
  41. function lsp_wrapper.list_workspace_folders()
  42. vim.lsp.buf.list_workspace_folders()
  43. end
  44. function lsp_wrapper.outgoing_calls()
  45. vim.lsp.buf.outgoing_calls()
  46. end
  47. function lsp_wrapper.range_code_action()
  48. vim.lsp.buf.range_code_action()
  49. end
  50. function lsp_wrapper.range_formatting()
  51. vim.lsp.buf.range_formatting()
  52. end
  53. function lsp_wrapper.references()
  54. vim.lsp.buf.references()
  55. vim.lsp.buf.clear_references()
  56. end
  57. function lsp_wrapper.remove_workspace_folder()
  58. vim.lsp.buf.remove_workspace_folder()
  59. end
  60. function lsp_wrapper.rename()
  61. vim.lsp.buf.rename()
  62. end
  63. function lsp_wrapper.signature_help()
  64. vim.lsp.buf.signature_help()
  65. end
  66. function lsp_wrapper.type_definition()
  67. vim.lsp.buf.type_definition()
  68. end
  69. function lsp_wrapper.workspace_symbol()
  70. vim.lsp.buf.workspace_symbol()
  71. end
  72. -- diagnostic
  73. function lsp_wrapper.get_all()
  74. vim.lsp.diagnostic.get_all()
  75. end
  76. function lsp_wrapper.get_next()
  77. vim.lsp.diagnostic.get_next()
  78. end
  79. function lsp_wrapper.get_prev()
  80. vim.lsp.diagnostic.get_prev()
  81. end
  82. function lsp_wrapper.goto_next()
  83. vim.lsp.diagnostic.goto_next()
  84. end
  85. function lsp_wrapper.goto_prev()
  86. vim.lsp.diagnostic.goto_prev()
  87. end
  88. function lsp_wrapper.show_line_diagnostics()
  89. vim.lsp.diagnostic.show_line_diagnostics()
  90. end
  91. -- misc
  92. -- :lua print(vim.inspect(vim.lsp.buf_get_clients()))
  93. -- autoformat
  94. -- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
  95. return lsp_wrapper
  96. -- You can see more about the differences in types here:
  97. -- https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight
  98. -- *hl-LspReferenceText*
  99. -- LspReferenceText used for highlighting "text" references
  100. -- *hl-LspReferenceRead*
  101. -- LspReferenceRead used for highlighting "read" references
  102. -- *hl-LspReferenceWrite*
  103. -- LspReferenceWrite used for highlighting "write" references
  104. -- *lsp-highlight-diagnostics*
  105. -- All highlights defined for diagnostics begin with `LspDiagnostics` followed by
  106. -- the type of highlight (e.g., `Sign`, `Underline`, etc.) and then the Severity
  107. -- of the highlight (e.g. `Error`, `Warning`, etc.)
  108. -- Sign, underline and virtual text highlights (by default) are linked to their
  109. -- corresponding LspDiagnosticsDefault highlight.
  110. -- For example, the default highlighting for |hl-LspDiagnosticsSignError| is
  111. -- linked to |hl-LspDiagnosticsDefaultError|. To change the default (and
  112. -- therefore the linked highlights), use the |:highlight| command: >
  113. -- highlight LspDiagnosticsDefaultError guifg="BrightRed"
  114. -- <
  115. -- *hl-LspDiagnosticsDefaultError*
  116. -- LspDiagnosticsDefaultError
  117. -- Used as the base highlight group.
  118. -- Other LspDiagnostic highlights link to this by default (except Underline)
  119. -- *hl-LspDiagnosticsDefaultWarning*
  120. -- LspDiagnosticsDefaultWarning
  121. -- Used as the base highlight group.
  122. -- Other LspDiagnostic highlights link to this by default (except Underline)
  123. -- *hl-LspDiagnosticsDefaultInformation*
  124. -- LspDiagnosticsDefaultInformation
  125. -- Used as the base highlight group.
  126. -- Other LspDiagnostic highlights link to this by default (except Underline)
  127. -- *hl-LspDiagnosticsDefaultHint*
  128. -- LspDiagnosticsDefaultHint
  129. -- Used as the base highlight group.
  130. -- Other LspDiagnostic highlights link to this by default (except Underline)
  131. -- *hl-LspDiagnosticsVirtualTextError*
  132. -- LspDiagnosticsVirtualTextError
  133. -- Used for "Error" diagnostic virtual text.
  134. -- See |vim.lsp.diagnostic.set_virtual_text()|
  135. -- *hl-LspDiagnosticsVirtualTextWarning*
  136. -- LspDiagnosticsVirtualTextWarning
  137. -- Used for "Warning" diagnostic virtual text.
  138. -- See |vim.lsp.diagnostic.set_virtual_text()|
  139. -- *hl-LspDiagnosticsVirtualTextInformation*
  140. -- LspDiagnosticsVirtualTextInformation
  141. -- Used for "Information" diagnostic virtual text.
  142. -- See |vim.lsp.diagnostic.set_virtual_text()|
  143. -- *hl-LspDiagnosticsVirtualTextHint*
  144. -- LspDiagnosticsVirtualTextHint
  145. -- Used for "Hint" diagnostic virtual text.
  146. -- See |vim.lsp.diagnostic.set_virtual_text()|
  147. -- *hl-LspDiagnosticsUnderlineError*
  148. -- LspDiagnosticsUnderlineError
  149. -- Used to underline "Error" diagnostics.
  150. -- See |vim.lsp.diagnostic.set_underline()|
  151. -- *hl-LspDiagnosticsUnderlineWarning*
  152. -- LspDiagnosticsUnderlineWarning
  153. -- Used to underline "Warning" diagnostics.
  154. -- See |vim.lsp.diagnostic.set_underline()|
  155. -- *hl-LspDiagnosticsUnderlineInformation*
  156. -- LspDiagnosticsUnderlineInformation
  157. -- Used to underline "Information" diagnostics.
  158. -- See |vim.lsp.diagnostic.set_underline()|
  159. -- *hl-LspDiagnosticsUnderlineHint*
  160. -- LspDiagnosticsUnderlineHint
  161. -- Used to underline "Hint" diagnostics.
  162. -- See |vim.lsp.diagnostic.set_underline()|
  163. -- *hl-LspDiagnosticsFloatingError*
  164. -- LspDiagnosticsFloatingError
  165. -- Used to color "Error" diagnostic messages in diagnostics float.
  166. -- See |vim.lsp.diagnostic.show_line_diagnostics()|
  167. -- *hl-LspDiagnosticsFloatingWarning*
  168. -- LspDiagnosticsFloatingWarning
  169. -- Used to color "Warning" diagnostic messages in diagnostics float.
  170. -- See |vim.lsp.diagnostic.show_line_diagnostics()|
  171. -- *hl-LspDiagnosticsFloatingInformation*
  172. -- LspDiagnosticsFloatingInformation
  173. -- Used to color "Information" diagnostic messages in diagnostics float.
  174. -- See |vim.lsp.diagnostic.show_line_diagnostics()|
  175. -- *hl-LspDiagnosticsFloatingHint*
  176. -- LspDiagnosticsFloatingHint
  177. -- Used to color "Hint" diagnostic messages in diagnostics float.
  178. -- See |vim.lsp.diagnostic.show_line_diagnostics()|
  179. -- *hl-LspDiagnosticsSignError*
  180. -- LspDiagnosticsSignError
  181. -- Used for "Error" signs in sign column.
  182. -- See |vim.lsp.diagnostic.set_signs()|
  183. -- *hl-LspDiagnosticsSignWarning*
  184. -- LspDiagnosticsSignWarning
  185. -- Used for "Warning" signs in sign column.
  186. -- See |vim.lsp.diagnostic.set_signs()|
  187. -- *hl-LspDiagnosticsSignInformation*
  188. -- LspDiagnosticsSignInformation
  189. -- Used for "Information" signs in sign column.
  190. -- See |vim.lsp.diagnostic.set_signs()|
  191. -- *hl-LspDiagnosticsSignHint*
  192. -- LspDiagnosticsSignHint
  193. -- Used for "Hint" signs in sign column.
  194. -- See |vim.lsp.diagnostic.set_signs()|