refactoring and README update

This commit is contained in:
XeroOl 2022-08-20 16:07:14 -05:00
parent a09035dabc
commit 224684d688
No known key found for this signature in database
GPG Key ID: 9DD4B4B4DAED0322
4 changed files with 34 additions and 20 deletions

View File

@ -1,8 +1,7 @@
# fennel-ls # fennel-ls
TO PROSPECTIVE USERS:
THIS PROJECT IS NOT IN A USABLE STATE YET. CHECK BACK LATER.
A language server for fennel-ls. A language server for fennel-ls.
Uses static analysis, and doesn't actually run your code, which makes it perfect for analyzing your (os.execute "rm -rf") code.
If you want live analysis of your code as it runs, consider using a REPL.
Features / To Do List / Things I would enjoy patches for: Features / To Do List / Things I would enjoy patches for:
@ -10,24 +9,28 @@ Features / To Do List / Things I would enjoy patches for:
- [ ] Support for UTF-8 characters that aren't just plain ASCII. (especially `λ`) - [ ] Support for UTF-8 characters that aren't just plain ASCII. (especially `λ`)
- [ ] Settings to configure lua / fennel path, allowed globals, etc - [ ] Settings to configure lua / fennel path, allowed globals, etc
- [ ] Builds for anything other than arch linux - [ ] Builds for anything other than arch linux
- [ ] Go-to-definition - [ ] Go-to-definition understands:
- [ ] directly on require statements - [X] literal table constructor
- [X] for definitions in the same file - [X] table destructuring
- [X] for definitions in other files - [X] require
- [X] follows multisyms through table constructor - [X] multisyms
- [ ] follows multisyms through mutations (difficult) - [X] . builtin (when called with constants)
- [ ] for methods/metamethods (difficult, in the general case may require type annotations or some insane global type inference logic) - [X] macros (a little bit)
- [ ] into lua files (maybe cheeseable with antifennel if it has --correlate?) - [ ] lua files
- [ ] setmetatable
- [ ] Reports compiler errors - [ ] function arguments / function calls
- [X] Reports compiler errors
- [ ] including in macro files - [ ] including in macro files
- [ ] Reports linting issues - [ ] Reports linting issues
- [ ] Completion Suggestions - [ ] Completion Suggestions
- [X] Hover over a symbol for documentation - [X] Hover over a symbol for documentation
- [ ] Signature help - [ ] Signature help
- [ ] Go-to-references on definition sites - [ ] Go-to-references
- [ ] integration with fnlfmt - [ ] rename
- [ ] Maybe some sort of type checking?? - [ ] formatting with fnlfmt
- [ ] Maybe some sort of type checking???
{field: {}}
## Setup: ## Setup:

View File

@ -120,7 +120,7 @@
(table.insert diagnostics (table.insert diagnostics
{:range range {:range range
:message msg :message msg
:severity 3 :severity message.severity.ERROR
:code 201 :code 201
:codeDescription "compiler error"})) :codeDescription "compiler error"}))
(call-me-to-reset-the-compiler) (call-me-to-reset-the-compiler)
@ -145,7 +145,11 @@
(let [scope (fennel.scope)] (let [scope (fennel.scope)]
(each [_i form (ipairs ast)] (each [_i form (ipairs ast)]
;; COMPILE ;; COMPILE
(match (pcall fennel.compile form {:filename file.uri : scope :plugins [plugin]}) (match (pcall fennel.compile form {:filename file.uri
:plugins [plugin]
:allowedGlobals (icollect [k v (pairs _G)] k)
:requireAsInclude false
: scope})
(where (nil err) (not= err "__NOT_AN_ERROR")) (where (nil err) (not= err "__NOT_AN_ERROR"))
(error err))) (error err)))
(set file.ast ast)) (set file.ast ast))

View File

@ -23,6 +23,12 @@ to look to fix this in the future."
:ContentModified -32801 ;; I don't think this one is useful unless we do async things :ContentModified -32801 ;; I don't think this one is useful unless we do async things
:RequestCancelled -32800}) ;; I don't think I'm going to even support cancelling things, that sounds like a pain :RequestCancelled -32800}) ;; I don't think I'm going to even support cancelling things, that sounds like a pain
(local severity
{:ERROR 1
:WARN 2
:INFO 3
:HINT 4})
(λ create-error [code message ?id ?data] (λ create-error [code message ?id ?data]
{:jsonrpc "2.0" {:jsonrpc "2.0"
:id ?id :id ?id
@ -80,4 +86,5 @@ to look to fix this in the future."
: ast->range : ast->range
: log : log
: range-and-uri : range-and-uri
: diagnostics} : diagnostics
: severity}