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
TO PROSPECTIVE USERS:
THIS PROJECT IS NOT IN A USABLE STATE YET. CHECK BACK LATER.
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:
@ -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 `λ`)
- [ ] Settings to configure lua / fennel path, allowed globals, etc
- [ ] Builds for anything other than arch linux
- [ ] Go-to-definition
- [ ] directly on require statements
- [X] for definitions in the same file
- [X] for definitions in other files
- [X] follows multisyms through table constructor
- [ ] follows multisyms through mutations (difficult)
- [ ] for methods/metamethods (difficult, in the general case may require type annotations or some insane global type inference logic)
- [ ] into lua files (maybe cheeseable with antifennel if it has --correlate?)
- [ ] Reports compiler errors
- [ ] Go-to-definition understands:
- [X] literal table constructor
- [X] table destructuring
- [X] require
- [X] multisyms
- [X] . builtin (when called with constants)
- [X] macros (a little bit)
- [ ] lua files
- [ ] setmetatable
- [ ] function arguments / function calls
- [X] Reports compiler errors
- [ ] including in macro files
- [ ] Reports linting issues
- [ ] Completion Suggestions
- [X] Hover over a symbol for documentation
- [ ] Signature help
- [ ] Go-to-references on definition sites
- [ ] integration with fnlfmt
- [ ] Maybe some sort of type checking??
- [ ] Go-to-references
- [ ] rename
- [ ] formatting with fnlfmt
- [ ] Maybe some sort of type checking???
{field: {}}
## Setup:

View File

@ -120,7 +120,7 @@
(table.insert diagnostics
{:range range
:message msg
:severity 3
:severity message.severity.ERROR
:code 201
:codeDescription "compiler error"}))
(call-me-to-reset-the-compiler)
@ -145,7 +145,11 @@
(let [scope (fennel.scope)]
(each [_i form (ipairs ast)]
;; 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"))
(error err)))
(set file.ast ast))

View File

@ -51,7 +51,7 @@
(set search
(λ search [self file item stack]
(if
(if
(sym? item) (search-symbol self file item stack)
(list? item) (search-list self file item stack)
(= :table (type item)) (search-table self file item stack)

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
: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]
{:jsonrpc "2.0"
:id ?id
@ -80,4 +86,5 @@ to look to fix this in the future."
: ast->range
: log
: range-and-uri
: diagnostics}
: diagnostics
: severity}