mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
1.09k stars 62 forks source link

AttributeError: module 'argparse' has no attribute 'BooleanOptionalAction' when using quickstart configuration #447

Closed FidelVe closed 1 year ago

FidelVe commented 1 year ago

LSP client configuration

local config = {
        cmd = {'/home/fidel/.local/opt/jdtls-launcher/jdtls/bin/jdtls'},
        root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, {     upward = true })[1]),
   }
require('jdtls').start_or_attach(config)

Eclipse.jdt.ls version

1.6.400.v20210924-0641

Steps to Reproduce

followed the instructions using the quickstart

Expected Result

no error

Actual Result

content of lsp.log

[START][2023-03-19 00:33:33] LSP logging initiated
[ERROR][2023-03-19 00:33:33] .../vim/lsp/rpc.lua:439  "rpc" "/home/fidel/.loc    al/opt/jdtls-launcher/jdtls/bin/jdtls" "stderr"  "Traceback (most recent call     last):\n  File \"/home/fidel/.local/opt/jdtls-launcher/jdtls/bin/jdtls\", li    ne 17, in <module>\n    jdtls.main(sys.argv[1:])\n  File \"/home/fidel/.local    /opt/jdtls-launcher/jdtls/bin/jdtls.py\", line 73, in main\n    parser.add_ar    gument(\"--validate-java-version\", default=True, action=argparse.BooleanOpti    onalAction)\nAttributeError: module 'argparse' has no attribute 'BooleanOptio    nalAction'\n"

result of running :lua require('jdtls').compile('full') is No LSP client with name jdtls available

mfussenegger commented 1 year ago

The jdtls.py script shipped with eclipse.jdt.ls uses argparse.BooleanOptionalAction which is only available in Python 3.9.

You'll either have to:

mfussenegger commented 1 year ago

Added this to the readme https://github.com/mfussenegger/nvim-jdtls/commit/34202bc141620858159616ff79bd8a3c48c34214