Skip to content

lspce-jdtls-completion-max-results does not change the max results returned by completion-at-point #48

Description

@Matthew-Craig01

jdtls in java-ts-mode is returning a maximum of 50 completion results, despite setting lspce-jdtls-completion-max-results to 5.

I have the following in my config:

(setq lspce-jdtls-completion-max-results 5)
;; Copied from README
(setq lspce-server-programs `(("rust"  "rust-analyzer" "" lspce-ra-initializationOptions)
                           ("python" "pylsp" "" )
                           ("C" "clangd" "--all-scopes-completion --clang-tidy --enable-config --header-insertion-decorators=0")
                           ("java" "java" lspce-jdtls-cmd-args lspce-jdtls-initializationOptions)))

The lspce-jdtls-completion-max-results initialization option is being processed because the log shows the following (notice maxResults: 5):

2025-02-27 22:08:43.901 - initialize request {
  "id": "1000000301",
  "method": "initialize",
  "params": {
    "capabilities": {
      "experimental": {},
      "textDocument": {
        "callHierarchy": {
          "dynamicRegistration": false
        },
        "codeAction": {
          "codeActionLiteralSupport": {
            "codeActionKind": {
              "valueSet": [
                "quickfix",
                "refactor",
                "refactor.extract",
                "refactor.inline",
                "refactor.rewrite",
                "source",
                "source.organizeImports"
              ]
            }
          },
          "dataSupport": false,
          "disabledSupport": false,
          "dynamicRegistration": false,
          "isPreferredSupport": true
        },
        "completion": {
          "completionItem": {
            "commitCharactersSupport": false,
            "deprecatedSupport": true,
            "documentationFormat": [
              "markdown",
              "plaintext"
            ],
            "insertReplaceSupport": false,
            "preselectSupoort": false,
            "resolveSupport": {
              "properties": [
                "documentation",
                "details",
                "additionalTextEdits"
              ]
            },
            "snippetSupport": true,
            "tagSupport": {
              "valueSet": [
                1
              ]
            }
          },
          "contextSupport": true,
          "dynamicRegistration": false
        },
        "declaration": {
          "dynamicRegistration": false,
          "linkSupport": false
        },
        "definition": {
          "dynamicRegistration": false,
          "linkSupport": false
        },
        "documentHighlight": {
          "dynamicRegistration": false
        },
        "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
            ]
          }
        },
        "formatting": {
          "dynamicRegistration": false
        },
        "hover": {
          "contentFormat": [
            "markdown",
            "plaintext"
          ],
          "dynamicRegistration": false
        },
        "implementation": {
          "dynamicRegistration": false,
          "linkSupport": false
        },
        "inlayHint": {
          "dynamicRegistration": false
        },
        "publishDiagnostics": {
          "codeDescriptionSupport": false,
          "dataSupport": false,
          "relatedInformation": false,
          "tagSupport": {
            "valueSet": [
              1,
              2
            ]
          },
          "versionSupport": false
        },
        "rangeFormatting": {
          "dynamicRegistration": false
        },
        "references": {
          "dynamicRegistration": false
        },
        "rename": {
          "dynamicRegistration": false,
          "honorsChangeAnnotations": false,
          "prepareSupport": false
        },
        "signatureHelp": {
          "contextSupport": false,
          "dynamicRegistration": false,
          "signatureInformation": {
            "activeParameterSupport": false,
            "documentationFormat": [
              "markdown",
              "plaintext"
            ],
            "parameterInformation": {
              "labelOffsetSupport": false
            }
          }
        },
        "synchronization": {
          "didSave": true,
          "dynamicRegistration": false,
          "willSave": true
        },
        "typeDefinition": {
          "dynamicRegistration": false,
          "linkSupport": false
        }
      },
      "workspace": {
        "applyEdit": false,
        "configuration": false,
        "executeCommand": {
          "dynamicRegistration": false
        },
        "symbol": {
          "dynamicRegistration": false
        },
        "workspaceEdit": {
          "documentChanges": true,
          "resourceOperations": [
            "create",
            "rename",
            "delete"
          ]
        },
        "workspaceFolders": false
      }
    },
    "clientInfo": {
      "name": "lspce",
      "version": "1.1.0"
    },
    "initializationOptions": {
      "extendedClientCapabilities": {
        "classFileContentsSupport": true
      },
      "settings": {
        "java": {
          "autobuild": {
            "enabled": true
          },
          "completion": {
            "enabled": true,
            "guessMethodArguments": true,
            "importOrder": [
              "java",
              "javax",
              "com",
              "org"
            ],
            "maxResults": 5
          },
          "configuration": {
            "checkProjectSettingsExclusions": true,
            "updateBuildConfiguration": "automatic"
          },
          "foldingRange": {
            "enabled": false
          },
          "import": {
            "gradle": {
              "enabled": true,
              "offline": {
                "enabled": true
              },
              "wrapper": {
                "enabled": true
              }
            },
            "maven": {
              "enabled": true
            }
          },
          "maven": {
            "downloadSources": true,
            "updateSnapshots": true
          },
          "maxConcurrentBuilds": 1,
          "progressReports": {
            "enabled": true
          },
          "project": {
            "importHint": true,
            "importOnFirstTimeStartup": "automatic",
            "referecedLibraries": [
              "lib/**/*.jar"
            ]
          },
          "server": {
            "launchMode": "Hybrid"
          },
          "showBuildStatusOnStart": {
            "enabled": true
          },
          "signatureHelp": {
            "enabled": true
          },
          "trace": {
            "server": "off"
          }
        }
      }
    },
    "processId": 622510,
    "rootPath": "file:///home/matthew/Code/Java/Leetcode",
    "rootUri": "file:///home/matthew/Code/Java/Leetcode"
  },
  "request_tick": "1674_1006_/home/matthew/Code/Java/Leetcode/src/main/java/MinOfRotatedArray/Solution.java"
}

However, running completion-at-point returns a maximum of 50 results, rather than 5.
I want to edit this value so that I can have a very high value specifically for manual vertico-based completion-at-point.

I suspect that none of the settings are being applied because changing (lspce--add-option "settings.java.completion.enabled" t options) in lspce-jdtls-initializationOptions to (lspce--add-option "settings.java.completion.enabled" nil options) does not disable completion.

A possible guess is that settings aren't meant to come inside of initialization options. I do not know much about jdtls but it seems to be done this way in Sublime's configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions