ale icon indicating copy to clipboard operation
ale copied to clipboard

ada: adals is incorrectly initialised

Open humenda opened this issue 1 year ago • 0 comments

I am to use ALE with Vim 9.0, on Debian 12.2. I can use ALE fine with languages such as Rust or Python, but it fails when using the ada_language_server (linter name: adals). The linters report "missing project root", like this (first screen line of vim in the project):

E --  vim: set tw=80: /* E: No project found in root directory. Please create a project file

I made a dump of the LSP communication and the initialisation strings look different indeed:

neovim (no ALE):

{
  "method": "initialize",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "trace": "off",
    "capabilities": {
      "window": {
        "workDoneProgress": true,
        "showMessage": {
          "messageActionItem": {
            "additionalPropertiesSupport": false
          }
        },
        "showDocument": {
          "support": false
        }
      },
      "workspace": {
        "applyEdit": true,
        "workspaceEdit": {
          "resourceOperations": [
            "rename",
            "create",
            "delete"
          ]
        },
        "workspaceFolders": true,
        "symbol": {
          "dynamicRegistration": false,
          "symbolKind": {
            "valueSet": [
              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
            ]
          },
          "hierarchicalWorkspaceSymbolSupport": true
        },
        "configuration": true
      },
      "textDocument": {
        "signatureHelp": {
          "dynamicRegistration": false,
          "signatureInformation": {
            "documentationFormat": [
              "markdown",
              "plaintext"
            ],
            "activeParameterSupport": true,
            "parameterInformation": {
              "labelOffsetSupport": true
            }
          }
        },
        "implementation": {
          "linkSupport": true
        },
        "declaration": {
          "linkSupport": true
        },
        "references": {
          "dynamicRegistration": false
        },
        "documentHighlight": {
          "dynamicRegistration": false
        },
        "synchronization": {
          "dynamicRegistration": false,
          "willSave": false,
          "willSaveWaitUntil": false,
          "didSave": true
        },
        "completion": {
          "dynamicRegistration": false,
          "completionItem": {
            "deprecatedSupport": false,
            "documentationFormat": [
              "markdown",
              "plaintext"
            ],
            "snippetSupport": false,
            "commitCharactersSupport": false,
            "preselectSupport": false
          },
          "completionItemKind": {
            "valueSet": [
              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
            ]
          },
          "contextSupport": false
        },
        "rename": {
          "dynamicRegistration": false,
          "prepareSupport": true
        },
        "documentSymbol": {
          "dynamicRegistration": false,
          "hierarchicalDocumentSymbolSupport": true,
          "symbolKind": {
            "valueSet": [
              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
            ]
          }
        },
        "publishDiagnostics": {
          "relatedInformation": true,
          "tagSupport": {
            "valueSet": [
              1,
              2
            ]
          }
        },
        "hover": {
          "dynamicRegistration": false,
          "contentFormat": [
            "markdown",
            "plaintext"
          ]
        },
        "definition": {
          "linkSupport": true
        },
        "typeDefinition": {
          "linkSupport": true
        },
        "codeAction": {
          "dynamicRegistration": false,
          "codeActionLiteralSupport": {
            "codeActionKind": {
              "valueSet": [
                "",
                "Empty",
                "QuickFix",
                "Refactor",
                "RefactorExtract",
                "RefactorInline",
                "RefactorRewrite",
                "Source",
                "SourceOrganizeImports",
                "quickfix",
                "refactor",
                "refactor.extract",
                "refactor.inline",
                "refactor.rewrite",
                "source",
                "source.organizeImports"
              ]
            }
          },
          "resolveSupport": {
            "properties": [
              "edit"
            ]
          },
          "dataSupport": true
        }
      },
      "callHierarchy": {
        "dynamicRegistration": false
      }
    },
    "initializationOptions": {},
    "rootPath": "/home/horst/src/toy",
    "rootUri": "file:///home/horst/src/toy",
    "workspaceFolders": [
      {
        "name": "/home/horst/src/toy",
        "uri": "file:///home/horst/src/toy"
      }
    ],
    "processId": 202598,
    "clientInfo": {
      "name": "Neovim",
      "version": "0.7.2"
    }
  }
}

Vim with ALE:

{
  "method": "initialize",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "initializationOptions": {},
    "rootUri": "file:///home/horst/src/toy/src",
    "capabilities": {
      "workspace": {
        "workspaceFolders": false,
        "configuration": false,
        "symbol": {
          "dynamicRegistration": false
        },
        "applyEdit": false,
        "didChangeConfiguration": {
          "dynamicRegistration": false
        }
      },
      "textDocument": {
        "documentSymbol": {
          "dynamicRegistration": false,
          "hierarchicalDocumentSymbolSupport": false
        },
        "references": {
          "dynamicRegistration": false
        },
        "publishDiagnostics": {
          "relatedInformation": true
        },
        "rename": {
          "dynamicRegistration": false
        },
        "completion": {
          "completionItem": {
            "snippetSupport": false,
            "commitCharactersSupport": false,
            "preselectSupport": false,
            "deprecatedSupport": false,
            "documentationFormat": [
              "plaintext"
            ]
          },
          "contextSupport": false,
          "dynamicRegistration": false
        },
        "synchronization": {
          "didSave": true,
          "willSaveWaitUntil": false,
          "willSave": false,
          "dynamicRegistration": false
        },
        "codeAction": {
          "codeActionLiteralSupport": {
            "codeActionKind": {
              "valueSet": []
            }
          },
          "dynamicRegistration": false
        },
        "typeDefinition": {
          "dynamicRegistration": false
        },
        "hover": {
          "dynamicRegistration": false,
          "contentFormat": [
            "plaintext"
          ]
        },
        "implementation": {
          "dynamicRegistration": false,
          "linkSupport": false
        },
        "definition": {
          "dynamicRegistration": false,
          "linkSupport": false
        }
      }
    },
    "rootPath": "/home/horst/src/toy/src",
    "processId": 210968
  }
}

I have tried to set the project root myself:

function! FindGitRoot()
  return system('git rev-parse --show-toplevel 2>/dev/null')[:-2]
endfunction

let g:ale_lsp_root = {
\   'ada': function('FindGitRoot')
\}

with no success. Yet, :ALEInfo reports that adals was successfully started.

From the JSON, I can see that Neovim is escaping paths, something that might confuse the adals in the Vim9/ALE setup. Furthermore, it seems that the root path is incorrectly determined.

As it works out of the box, I suspect a (small) issue in the adals integration of ALE. I can confirm this behaviour in a unconfigured vim, with just filetype on.

:ALEInfo
Current Filetype: ada
Available Linters: ['adals', 'cspell', 'gcc']
  Enabled Linters: ['adals', 'cspell', 'gcc']
  Ignored Linters: []
 Suggested Fixers:
  'gnatpp' - Format Ada files with gnatpp.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

 Linter Variables:
" Press Space to read :help for a setting
let g:ale_ada_adals_encoding = 'utf-8'
let g:ale_ada_adals_executable = 'ada_language_server'
let g:ale_ada_adals_project = 'default.gpr'
let g:ale_ada_gcc_executable = 'gcc'
let g:ale_ada_gcc_options = '-gnatwa -gnatq'

 Global Variables:
" Press Space to read :help for a setting
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E'
let g:ale_sign_info = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E'
let g:ale_sign_style_warning = 'W'
let g:ale_sign_warning = 'W'
let g:ale_sign_highlight_linenrs = 0
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1

  Command History:

(executable check - success) ada_language_server
(executable check - failure) cspell
(executable check - success) gcc
(finished - exit code 0) ['/bin/zsh', '-c', '''gcc'' -x ada -c -gnatc -o ''/tmp/viPVEsk/1/foo.o'' -I ''/tmp/foo/src'' -gnatwa -gnatq ''/tmp/viPVEsk/2/foo.adb''']

<<<NO OUTPUT RETURNED>>>

(started) ['/bin/zsh', '-c', '''ada_language_server''']

humenda avatar Dec 14 '23 15:12 humenda