Skip to content

Instantly share code, notes, and snippets.

@gdkrmr
Last active May 19, 2020 12:31
Show Gist options
  • Save gdkrmr/624e423f774768563f30e1bd719579a4 to your computer and use it in GitHub Desktop.
Save gdkrmr/624e423f774768563f30e1bd719579a4 to your computer and use it in GitHub Desktop.
Reproduce non-working flycheck
Ok, here is how I can reproduce it from scratch, sorry that this is so complicated:
0) Download Julia 1.4 (https://julialang.org/downloads/) and put the executable in your path. I am using the generic linux binaries and symlink `/julia-1.4/bin/julia` to `~/bin/julia`
1) Clone some Julia project, e.g.
```
git clone https://github.com/gdkrmr/Base58.jl.git
```
2) clone `lsp-julia` recursively from `https://github.com/gdkrmr/lsp-julia.git`
```
git clone --recurse-submodules
```
3) Patch the submodule LanguageServer.jl with the file in the [gist](https://gist.github.com/gdkrmr/624e423f774768563f30e1bd719579a4#file-languageserver-patch). Sorry for that, the PR is not merged yet (https://github.com/julia-vscode/LanguageServer.jl/pull/688)
4) Edit the path to `lsp-julia` in the [gist](https://gist.github.com/gdkrmr/624e423f774768563f30e1bd719579a4#file-lsp-start-plain-el) and run emacs:
```
emacs -q -l lsp-start-plain.el
```
5) Open `Base58/src/Base58.jl`, this takes ~30s to precompile the Languageserver the first time you do it. Open the `flycheck` buffer. I cannot see any problems in mine if I open it with Emacs. Opening it in VSCode it shows a dozen problems.
diff --git a/src/protocol/basic.jl b/src/protocol/basic.jl
index d876168..b3c3804 100644
--- a/src/protocol/basic.jl
+++ b/src/protocol/basic.jl
@@ -1,4 +1,5 @@
const ProgressToken = Union{Int, String}
+ProgressToken(x::ProgressToken) = x
struct ProgressParams{T}
token::ProgressToken
value::T
;;; lsp-start-plain.el --- LSP mode quick starter -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Ivan Yonchovski
;; Author: Zhu Zihao <all_but_last@163.com>
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This file is a helper to start a minimal lsp environment.
;; To use this, start your Emacs with "emacs -q" and load this file.
;; It will install `lsp-mode', `lsp-ui' with their dependencies to start a
;; minimal lsp environment.
;; And it forces Emacs to load `.el' files rather than `.elc' files
;; for more readable backtrace.
;;; Code:
(require 'package)
(setq debug-on-error t)
(let* ((package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
(no-byte-compile t)
(package-user-dir (expand-file-name (make-temp-name "lsp-tmp-elpa")
user-emacs-directory))
(custom-file (expand-file-name "custom.el" package-user-dir))
(pkg-list '(lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck julia-mode)))
(package-initialize)
(package-refresh-contents)
(mapcar (lambda (pkg)
(unless (package-installed-p pkg)
(package-install pkg))
(require pkg))
pkg-list)
(add-to-list 'load-path "~/progs/julia/lsp-julia")
(setq lsp-julia-command "julia-1.4")
(require 'lsp-julia)
(add-hook 'prog-mode-hook 'lsp)
(add-hook 'kill-emacs-hook `(lambda ()
(delete-directory ,package-user-dir t))))
(provide 'lsp-start-plain)
;;; lsp-start-plain.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment