Add --help and --version flags
This commit is contained in:
parent
e229f93fc1
commit
3200483011
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Support highlighting references to the symbol under the cursor in the current scope.
|
* Add --help and --version command line flags.
|
||||||
|
* Support providing improved completion kinds to clients.
|
||||||
|
* Support highlighting references to the symbol under the cursor in the current file.
|
||||||
* Support loading external docsets from disk.
|
* Support loading external docsets from disk.
|
||||||
* Extract TIC-80 docs to external docset.
|
* Extract TIC-80 docs to external docset.
|
||||||
* Support `:lua-version` settings like `"lua5.4"` rather than requiring `"lua54"`.
|
* Support `:lua-version` settings like `"lua5.4"` rather than requiring `"lua54"`.
|
||||||
|
|||||||
@ -51,12 +51,28 @@
|
|||||||
(let [msg (json-rpc.read in)]
|
(let [msg (json-rpc.read in)]
|
||||||
(dispatch.handle server send msg))))
|
(dispatch.handle server send msg))))
|
||||||
|
|
||||||
|
(local {: version} (require :fennel-ls.utils))
|
||||||
|
(local help "Usage: fennel-ls [FLAG] [FILES]
|
||||||
|
|
||||||
|
Run fennel-ls, the Fennel language server and linter.
|
||||||
|
|
||||||
|
--lint FILES : Run the linter on the provided files
|
||||||
|
a single dash (-) can be used to read from stdin
|
||||||
|
--server : Start the language server (stdio mode only)
|
||||||
|
optional, this is the default with no arguments
|
||||||
|
|
||||||
|
--help : Display this text
|
||||||
|
--version : Show version")
|
||||||
|
|
||||||
(λ main []
|
(λ main []
|
||||||
(case arg
|
(case arg
|
||||||
|
["--help"] (print help)
|
||||||
|
["--version"] (print version)
|
||||||
["--lint" & filenames] (lint filenames)
|
["--lint" & filenames] (lint filenames)
|
||||||
(where (or ["--server"] [nil])) (main-loop (io.input)
|
(where (or ["--server"] [nil])) (main-loop (io.input)
|
||||||
(io.output))
|
(io.output))
|
||||||
_args (do (io.stderr:write "USAGE: fennel-ls [--lint file] [--server]\n")
|
_args (do (io.stderr:write help)
|
||||||
|
(io.stderr:write "\n")
|
||||||
(os.exit 1))))
|
(os.exit 1))))
|
||||||
|
|
||||||
(main)
|
(main)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ Every time the client sends a message, it gets handled by a function in the corr
|
|||||||
;; :willDelete nil}}
|
;; :willDelete nil}}
|
||||||
;; :experimental nil)
|
;; :experimental nil)
|
||||||
{: capabilities
|
{: capabilities
|
||||||
:serverInfo {:name "fennel-ls" :version "0.1.0"}}))
|
:serverInfo {:name "fennel-ls" :version utils.version}}))
|
||||||
|
|
||||||
(λ requests.textDocument/definition [server _send {: position :textDocument {: uri}}]
|
(λ requests.textDocument/definition [server _send {: position :textDocument {: uri}}]
|
||||||
(let [file (files.get-by-uri server uri)
|
(let [file (files.get-by-uri server uri)
|
||||||
|
|||||||
@ -5,6 +5,8 @@ These functions are all pure functions, which makes me happy."
|
|||||||
|
|
||||||
(local fennel (require :fennel))
|
(local fennel (require :fennel))
|
||||||
|
|
||||||
|
(local version :0.2.0-dev)
|
||||||
|
|
||||||
(λ next-line [str ?from]
|
(λ next-line [str ?from]
|
||||||
"Find the start of the next line from a given byte offset, or from the start of the string."
|
"Find the start of the next line from a given byte offset, or from the start of the string."
|
||||||
(let [from (or ?from 1)]
|
(let [from (or ?from 1)]
|
||||||
@ -209,7 +211,8 @@ WARNING: this is only used in the test code, not in the real language server"
|
|||||||
(fn find [t x ?k]
|
(fn find [t x ?k]
|
||||||
(match (next t ?k) (k x) k (k y_) (find t x k)))
|
(match (next t ?k) (k x) k (k y_) (find t x k)))
|
||||||
|
|
||||||
{: uri->path
|
{: version
|
||||||
|
: uri->path
|
||||||
: path->uri
|
: path->uri
|
||||||
: pos->position
|
: pos->position
|
||||||
: byte->position
|
: byte->position
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user