aboutsummaryrefslogtreecommitdiff
path: root/lspc.lua
blob: 235a7e4164dffe961621e9cbda2fc4be2a9bbb80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
-- Copyright (c) 2021-2023 Florian Fischer. All rights reserved.
--
-- This file is part of vis-lspc.
--
-- vis-lspc is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software
-- Foundation, either version 3 of the License, or (at your option) any later
-- version.
--
-- vis-lspc is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with
-- vis-lspc found in the LICENSE file. If not, see <https://www.gnu.org/licenses/>.
--
-- State of our language server client
local lspc = {
  -- mapping language server names to their state tables
  running = {},
  name = 'vis-lspc',
  version = '0.1.8',
  -- write log messages to lspc.log_file
  logging = false,
  log_file = nil,
  -- automatically start a language server when a new window is opened
  autostart = true,
  -- program used to let the user make choices
  -- The available choices are pass to <menu_cmd> on stdin separated by '\n'
  menu_cmd = 'vis-menu -l 10',
  -- program used to ask the user for confirmation
  confirm_cmd = 'vis-menu',

  -- should diagnostics be highlighted if available
  highlight_diagnostics = false,
  -- style id used by lspc to register the style used to highlight diagnostics
  diagnostic_style_id = 64, -- 64 is the last style id available for the lexer styles. See vis/ui.h.
  -- style used by lspc to highlight the diagnostic range
  -- 60% solarized red
  diagnostic_style = 'back:#e3514f',

  -- restore the position of the primary curser after applying a workspace edit
  workspace_edit_remember_cursor = true,

  -- message level to show in the UI when receiving messages from the server
  -- Error = 1, Warning = 2, Info = 3, Log = 4
  message_level = 3,
}

--
--- ClientCapabilities we tell the language server when calling "initialize"
--
local supported_markup_kind = {'plaintext'}

local goto_methods_capabilities = {
  linkSupport = true,
  dynamicRegistration = false,
}

local client_capabilites = {
  workspace = {
    configuration = true,
    didChangeConfiguration = {dynamicRegistration = false},
  },
  textDocument = {
    synchronization = {dynamicRegistration = false, didSave = true},
    -- ask the server to send us only plaintext completionItems
    completion = {
      dynamicRegistration = false,
      completionItem = {documentationFormat = supported_markup_kind},
    },
    -- ask the server to send us only plaintext hover results
    hover = {dynamicRegistration = false, contentFormat = supported_markup_kind},
    -- ask the server to send us only plaintext signatureHelp results
    signatureHelp = {
      dynamicRegistration = false,
      signatureInformation = {documentationFormat = supported_markup_kind},
    },
    declaration = {dynamicRegistration = false, linkSupport = true},
    definition = goto_methods_capabilities,
    typeDefinition = goto_methods_capabilities,
    implementation = goto_methods_capabilities,
    references = {dynamicRegistration = false},
    rename = {
      dynamicRegistration = false,
      prepareSupport = false,
      honorsChangeAnnotations = false,
    },
  },
  window = {workDoneProgress = false, showDocument = {support = false}},
}

lspc.client_capabilites = client_capabilites

return lspc