emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.75k stars 869 forks source link

flycheck help please #44

Closed alanz closed 7 years ago

alanz commented 7 years ago

@vibhavp : which specific language server are you developing the flycheck stuff against?

I want to see a working version to compare for debugging my haskell one.

alanz commented 7 years ago

So, neither the golang-server nor rustls provide diagnostics.

pyls does, but I get the same error as with haskell, the key part being

error in process filter: progn: Error parsing language server output: (error Flycheck cannot use lsp in this buffer, type M-x flycheck-verify-setup for more details)

This is using spacemacs.

Start a new Language Server for this project? (y or n) y
lsp--stdio-send-sync: Content-Length: 168

{"jsonrpc":"2.0","method":"initialize","params":{"processId":6435,"rootPath":"/home/alanz/mysrc/github/palantir/python-language-server/test/","capabilities":{}},"id":1}
Output from language server: {"jsonrpc":"2.0","result":{"capabilities":{"documentRangeFormattingProvider":true,"documentFormattingProvider":true,"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["("]},"documentSymbolProvider":true,"completionProvider":{"triggerCharacters":["."],"resolveProvider":false},"textDocumentSync":1,"definitionProvider":true,"referencesProvider":true}},"id":1}
lsp--stdio-send-async: Content-Length: 457

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/alanz/mysrc/github/palantir/python-language-server/test/conftest.py","languageId":"python","version":0,"text":"# Copyright 2017 Palantir Technologies, Inc.\n\"\"\" py.test configuration\"\"\"\nimport logging\nfrom pyls.__main__ import LOG_FORMAT\n\nlogging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)\n\n\npytest_plugins = [\n    'test.fixtures'\n]\n"}}}
Output from language server: {"jsonrpc":"2.0","params":{"uri":"file:///home/alanz/mysrc/github/palantir/python-language-server/test/conftest.py","diagnostics":[]},"method":"textDocument/publishDiagnostics"}
error in process filter: progn: Error parsing language server output: (error Flycheck cannot use lsp in this buffer, type M-x flycheck-verify-setup for more details)
error in process filter: Error parsing language server output: (error Flycheck cannot use lsp in this buffer, type M-x flycheck-verify-setup for more details)
vibhavp commented 7 years ago

haskell-mode is enabled here. Could you tell me the output of flycheck-verify-setup?

alanz commented 7 years ago

See https://github.com/vibhavp/emacs-lsp/issues/39#issuecomment-291978635

alanz commented 7 years ago

And flycheck-verify-setup for pyls is

Syntax checkers for buffer conftest.py in python-mode:

  python-flake8 (disabled)
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Not found

  python-pylint (disabled)
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Not found

  python-pycompile
    - may enable: yes
    - executable: Found at /usr/bin/python

The following checker is explicitly selected for this buffer:

  lsp
    - major mode: `python-mode' not supported

Flycheck Mode is enabled. Use M-m u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 31snapshot (package: 20170324.340)
Emacs version:    25.1.1
System:           x86_64-pc-linux-gnu
Window system:    x
alanz commented 7 years ago

I think I may have missed this in lsp-flycheck.el

;; (with-eval-after-load 'lsp-mode
;;   (require 'lsp-flycheck)
;;   (lsp-flycheck-setup))
alanz commented 7 years ago

Yep, adding that to my setup does the trick.

So in my .spacemacs I have

(defun dotspacemacs/user-config ()
 ...
  (add-to-load-path "/home/alanz/mysrc/github/alanz/emacs-lsp")
  (require 'lsp-mode)
  (global-lsp-mode t)
  (with-eval-after-load 'lsp-mode
    (require 'lsp-flycheck)
    (lsp-flycheck-setup))
...
)
alanz commented 7 years ago

Fixed, and PR generated for documentation update: https://github.com/vibhavp/emacs-lsp/pull/46