-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: fix #396, #395 and #398 #409
base: master
Are you sure you want to change the base?
Changes from all commits
387222b
8b97ef1
15b9fd9
7646781
316e270
cb63a3b
8dda3dc
4319619
57bc1cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (C) 2020 Matthew "strager" Glazar | ||
# See end of file for extended copyright information. | ||
|
||
find_program(QUICK_LINT_JS_EMACS "emacs") | ||
|
||
if (NOT QUICK_LINT_JS_EMACS) | ||
return () | ||
endif () | ||
|
||
execute_process( | ||
COMMAND | ||
${QUICK_LINT_JS_EMACS} | ||
-Q -batch | ||
--eval "(princ (format \"%s.%s\" emacs-major-version emacs-minor-version))" | ||
RESULT_VARIABLE EMACS_EXIT_CODE | ||
OUTPUT_VARIABLE EMACS_VERSION) | ||
|
||
if (NOT EMACS_EXIT_CODE EQUAL 0) | ||
message(WARNING "Emacs (${QUICK_LINT_JS_EMACS}) found but can't get its version. Skipping...") | ||
return () | ||
endif() | ||
|
||
if (NOT EMACS_VERSION GREATER_EQUAL 24.5) | ||
message(WARNING "Emacs found (${QUICK_LINT_JS_EMACS}), but version ${EMACS_VERSION} is not supported. Skipping...") | ||
return () | ||
endif () | ||
|
||
set(QUICK_LINT_JS_EMACS_FOUND TRUE) | ||
message(STATUS "Found Emacs ${QUICK_LINT_JS_EMACS} (found suitable version \"${EMACS_VERSION}\" minimum required is \"24.5\")") | ||
|
||
mark_as_advanced(QUICK_LINT_JS_EMACS) | ||
|
||
# quick-lint-js finds bugs in JavaScript programs. | ||
# Copyright (C) 2020 Matthew "strager" Glazar | ||
# | ||
# This file is part of quick-lint-js. | ||
# | ||
# quick-lint-js 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. | ||
# | ||
# quick-lint-js 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 quick-lint-js. If not, see <https://www.gnu.org/licenses/>. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
;;; eglot-quicklintjs.el --- Eglot support for quick-lint-js -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
|
||
;; Version: 0.0.1 | ||
;; Author: Wagner Riffel <[email protected]> | ||
;; URL: https://quick-lint-js.com | ||
;; Keywords: languages, tools | ||
;; Package-Requires: ((quicklintjs "0.0.1") (eglot "1.7") (emacs "26.1")) | ||
|
||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js 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. | ||
;; | ||
;; quick-lint-js 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 quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; Eglot support for quick-lint-js. | ||
|
@@ -19,44 +42,13 @@ | |
;;; Code: | ||
|
||
(require 'eglot) | ||
(require 'quicklintjs) | ||
|
||
(defgroup eglot-quicklintjs nil | ||
"quick-lint-js Eglot integration." | ||
:group 'eglot-quicklintjs | ||
:link '(url-link :tag "Website" "https://quick-lint-js.com")) | ||
|
||
(defcustom eglot-quicklintjs-program "quick-lint-js" | ||
"Path to quick-lint-js program to run." | ||
:group 'eglot-quicklintjs | ||
:type 'stringp) | ||
|
||
(defcustom eglot-quicklintjs-args nil | ||
"Arguments to quick-lint-js." | ||
:group 'eglot-quicklintjs | ||
:type '(repeat string)) | ||
|
||
(add-to-list 'eglot-server-programs `(js-mode . (,eglot-quicklintjs-program | ||
"--lsp-server" | ||
,@eglot-quicklintjs-args))) | ||
;;;###autoload | ||
(with-eval-after-load 'eglot | ||
(add-to-list 'eglot-server-programs `(js-mode . ,(quicklintjs-find-program | ||
"--lsp-server")))) | ||
|
||
(provide 'eglot-quicklintjs) | ||
|
||
;; quick-lint-js finds bugs in JavaScript programs. | ||
;; Copyright (C) 2020 Matthew Glazar | ||
;; | ||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js 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. | ||
;; | ||
;; quick-lint-js 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 quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; eglot-quicklintjs.el ends here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
;;; flycheck-quicklintjs --- quick-lint-js Flycheck support -*- lexical-binding: t; -*- | ||
;;; flycheck-quicklintjs.el --- quick-lint-js Flycheck support -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
|
||
;; Version: 0.0.1 | ||
;; Author: Wagner Riffel <[email protected]> | ||
;; URL: https://quick-lint-js.com | ||
;; Keywords: languages, tools | ||
;; Package-Requires: ((quicklintjs "0.0.1") (flycheck "32-cvs") (emacs "24.5")) | ||
|
||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js 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. | ||
;; | ||
;; quick-lint-js 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 quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
|
@@ -35,19 +58,10 @@ | |
;;; Code: | ||
|
||
(require 'flycheck) | ||
|
||
(defgroup flycheck-quicklintjs nil | ||
"quick-lint-js Flycheck integration." | ||
:prefix "flycheck-" | ||
:group 'flycheck | ||
:group 'quicklintjs | ||
:link '(url-link :tag "Website" "https://quick-lint-js.com")) | ||
|
||
(flycheck-def-args-var flycheck-quicklintjs-args javascript-quicklintjs) | ||
(flycheck-def-executable-var javascript-quicklintjs "quick-lint-js") | ||
(require 'quicklintjs) | ||
|
||
(defun flycheck-quicklintjs-parse-errors (output checker buffer) | ||
"Parse quick-lint-js alist output format from OUTPUT" | ||
"Parse CHECKER quick-lint-js alist output format from OUTPUT." | ||
(mapcar (lambda (l) | ||
(let ((region (nth 0 l)) | ||
(sev (nth 1 l)) | ||
|
@@ -60,48 +74,31 @@ | |
:id code | ||
:buffer buffer | ||
:checker checker | ||
:end-pos (cdr region)))) (car (read-from-string output)))) | ||
:end-pos (cdr region)))) | ||
(car (read-from-string output)))) | ||
|
||
(flycheck-define-checker javascript-quicklintjs | ||
;;;###autoload | ||
(flycheck-define-command-checker 'javascript-quicklintjs | ||
"quick-lint-js finds bugs in JavaScript programs. | ||
|
||
https://quick-lint-js.com" | ||
:command ("quick-lint-js" | ||
"--output-format=emacs-lisp" | ||
(eval (let ((file (buffer-file-name))) | ||
(if file | ||
`("--path-for-config-search" ,file) | ||
()))) | ||
Comment on lines
-71
to
-74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you intentionally rewrite this code in this commit? This change seems unrelated to unifying settings. (The change looks fine, though.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, I think I merged the wrong piece on a conflict, i'll revert |
||
"--stdin" | ||
(eval flycheck-quicklintjs-args)) | ||
:standard-input t | ||
:error-parser flycheck-quicklintjs-parse-errors | ||
:command (quicklintjs-find-program | ||
"--output-format=emacs-lisp" | ||
(let ((file (buffer-file-name))) | ||
(when file (concat "--path-for-config-search=" file))) | ||
"--stdin") | ||
:standard-input 't | ||
:error-parser 'flycheck-quicklintjs-parse-errors | ||
:error-explainer (lambda (err) | ||
(let ((error-code (flycheck-error-id err)) | ||
(url "https://quick-lint-js.com/errors/#%s")) | ||
(and error-code `(url . ,(format url error-code))))) | ||
:modes js-mode) | ||
:modes 'js-mode) | ||
|
||
(add-to-list 'flycheck-checkers 'javascript-quicklintjs t) | ||
;;;###autoload | ||
(with-eval-after-load 'flycheck | ||
(add-to-list 'flycheck-checkers 'javascript-quicklintjs t)) | ||
|
||
(provide 'flycheck-quicklintjs) | ||
|
||
;; quick-lint-js finds bugs in JavaScript programs. | ||
;; Copyright (C) 2020 Matthew "strager" Glazar | ||
;; | ||
;; This file is part of quick-lint-js. | ||
;; | ||
;; quick-lint-js 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. | ||
;; | ||
;; quick-lint-js 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 quick-lint-js. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
;;; flycheck-quicklintjs.el ends here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need five separate packages? Could we make just one package? Seems simpler to make one package IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to use what emacs calls "multi-file" packages, it would require
tar
available while building the packages tho, i didn't use it here because i imagine that's unlikely totar
be available on a Windows machine, what you think? i'm fine with both ways.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake provides a tool to create
tar
archives: https://cmake.org/cmake/help/v3.21/manual/cmake.1.html#run-a-command-line-toolThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strager i made the change to use a tar archive as a single package, besides that it feel clunky, it's discouraged by package archives, do you think the last "problem" in this list applies here? i do think. https://github.com/melpa/melpa/blob/5d49574/CONTRIBUTING.org#fixing-typical-problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having multiple .el files in a package is discouraged? O_o I'm unsure if that's what the documentation actually says.
It says:
What does it mean to "look at" an .el file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In short, an .el file can be package on its own, its format something along the lines:
so when it says "look at" an .el file, is an .el file which is in this package format, when a package has multiple .el files, this format is not used, instead there should be a tar archive that contains all .el files along with a magic
<name>-pkg.el
, which must call(define-package ...args)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do one of two things:
I'm happy with the tar if it's already implemented and if it makes developing the plugin easier for us.