Skip to content

--systemStream mode emits non LSP text, which breaks neovim #893

@mhanberg

Description

@mhanberg

Your issue may already be reported! Please search on Github issues before creating one.

  • I'm submitting a ...

    • bug report
    • feature request
    • question
    • other
  • What is the current behavior?
    running java -jar path/to/jar --systemStream emits a bunch text that isn't LSP rpc messages

└─  als --systemStream
 DEBUG Main:main    Building LanguageServerImpl
 DEBUG ResolutionTaskManager:Processing request    changeState: PROCESSING_PROJECT
 DEBUG ResolutionTaskManager:Processing request    changeState: IDLE
 DEBUG WorkspaceList:buildWorkspaceAt    created default WorkspaceContentManager
 DEBUG ParserStagingArea:enqueue    enqueueing [CHANGE_CONFIG - ]
 DEBUG WorkspaceContentManager:Processing request    changeState: PROCESSING_PROJECT
 DEBUG WorkspaceContentManager:processTask    Tree unit:
 DEBUG Main:main    Launching services
 DEBUG Main:main    Connecting Client
 DEBUG WorkspaceContentManager:processTask    units for main file: [no main file]
 DEBUG WorkspaceContentManager:Processing request    changeState: PROCESSING_PROJECT
 DEBUG WorkspaceContentManager:processChangeConfigChanges    Processing Config Changes
 DEBUG WorkspaceContentManager:Processing request    next
 DEBUG WorkspaceContentManager:Processing request    changeState: IDLE
 DEBUG WorkspaceContentManager:init    Finished initialization for workspace at ''
  • If the current behavior is a bug, please provide the minimal steps to reproduce on ALS
  • see above
  • What is the expected behavior?

It should only emit the rpc messages on stdout so that it can work with stdio lsp clients correctly.

  • *What is the motivation/use case for changing the behavior? (for feature requests)
    to use with neovim

  • Please tell us about your environment:

    • ALS Version: what current develop branch is as of opening this issue Feb 24, 2023
    • ALS Distribution: JVM or JS (if known) JVM
    • OS: macOS
  • Other information (e.g. detailed explanation, stack traces, related issues, workarounds, links for us to have context, eg. StackOverflow, Gitter, etc)

I am using the following script and neovim code to start the LSP

#!/usr/bin/env bash

ALS_PATH=${ALS_PATH:-"$HOME/src/als/als-server/jvm/target/scala-2.12/als-server-assembly-5.4.0-SNAPSHOT.jar"}

java -jar "$ALS_PATH" "$@"
vim.api.nvim_create_autocmd("FileType", {
  group = vim.api.nvim_create_augroup("als", { clear = true }),
  pattern = "raml",
  callback = function()
    vim.lsp.start {
      name = "ALS",
      cmd = { "als", "--systemStream" },
      settings = {},
    }
  end,
})

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions