Commit Graph

250 Commits

Author SHA1 Message Date
XeroOl
d8bfaa3559 --check is now --lint 2024-06-23 15:44:35 -05:00
XeroOl
664ba9b13d bunch of small changes 2024-06-15 22:32:46 -05:00
Rudolf Adamkovič
d4343392ab Format '--check' errors so that tooling can detect them 2024-06-15 22:30:18 -05:00
XeroOl
14094762ab Switch from rxi/json to dkjson, switch folder structure 2024-06-09 17:36:19 -05:00
XeroOl
7469a8854c Remove faith's readme 2024-06-09 17:36:08 -05:00
XeroOl
8dc4f3d0f8 Rename language -> analyzer 2024-06-05 01:22:08 -05:00
XeroOl
c56ce89ccf λ now warns about unused arguments 2024-06-04 20:17:21 -05:00
XeroOl
7194838132 return both the server and client from create-client 2024-06-01 23:17:00 -05:00
XeroOl
9770e3eefd Rename self->client in tests 2024-06-01 23:12:42 -05:00
XeroOl
0ddd8f0bf0 TIC-80 docs sort of work?
{:fennel-ls {:native-libraries [:tic80]}}
2024-06-01 15:14:15 -05:00
XeroOl
e0067880d1 Unknown field lint only triggers at stack size 1
This is probably not a good commit message, but basically, if you
require a module foo, and then look for foo.bar.baz, it won't trigger,
but foo.bar will trigger it.
2024-05-29 22:38:55 -05:00
XeroOl
3f5984df06 Add extra check to textEdit
I really should just make it (pairs) through all the keys, but for now
I'll just keep adding the checks manually.
2024-05-29 22:01:56 -05:00
XeroOl
4c92af1bc5 Align allowed-globals with the currently selected docs 2024-05-17 20:45:37 -05:00
XeroOl
a122d9d361 Make the root folder optional 2024-05-17 20:45:16 -05:00
XeroOl
1a21ee623d fix positionEncoding to be a capability 2024-05-15 22:58:51 -05:00
XeroOl
3dc9e36af6 workaround for fennel#221 2024-05-14 00:46:10 -05:00
XeroOl
e37c77958d fix zero-arg documented function formatting 2024-05-14 00:18:07 -05:00
XeroOl
3fad66a476 Switch docs to autogenerated 2024-05-13 23:58:37 -05:00
XeroOl
0068662c8b add test for a fix I did a while ago 2024-05-13 01:53:52 -05:00
XeroOl
8d57f60369 remove some comments :) 2024-05-13 01:07:05 -05:00
XeroOl
4bce5c87ec Tests for reader macros 2024-05-13 01:06:46 -05:00
XeroOl
f17342b7ce Fix hashfn and quote and unquote 2024-05-12 16:45:18 -05:00
XeroOl
34e0bce092 Hover in hashfn 2024-05-12 15:32:43 -05:00
XeroOl
be44cda696 Unknown field errors in _G are suppressed 2024-05-12 12:26:24 -05:00
XeroOl
711c225e9c Fix crash when searching non-table documentation 2024-05-06 10:36:07 -05:00
XeroOl
2d7c8b1ad7 Lints for doc fields, doc hovers on strings 2024-05-04 15:37:01 -05:00
XeroOl
926dff9267 Docs when completing string fields 2024-05-04 15:37:01 -05:00
XeroOl
d06e0dfbe8
test function to check code actions don't exist 2024-05-04 01:27:37 -05:00
XeroOl
944f57cc08 No duplicate scope completions 2024-04-30 21:42:00 -05:00
XeroOl
343777d301 eglot completion quirk tests 2024-04-30 21:40:07 -05:00
XeroOl
311ce2645e fix fennel-ls#22
This is getting messy, but now the same sym can reference multiple
places. (. file references mysym) only holds the last one, but
(. file definitions <x> :referenced-by) could still hold older
references.
2024-04-07 23:18:14 -05:00
XeroOl
59b966a25f Add a bunch of tests for compiler recovery
Ideally, any time you write:

(local x (<some form with compiler error>))
(print x)

I don't want it to say "unknown variable x". To make sure that's the
case, I need to do as much error recovery as possible. I don't have full
error recovery, but I've got the common cases, and I'm working down the
fennel.friends list
2024-03-28 23:51:22 -05:00
XeroOl
3bc530e11b in tests, separate compile error diagnostics from lints 2024-03-28 23:04:25 -05:00
XeroOl
b5750b1a8a rename diagnostic to lint 2024-03-28 23:01:20 -05:00
XeroOl
0fd6a48ed2 basic code action test for the (+) -> 0 lint 2024-03-28 22:41:23 -05:00
XeroOl
e81920585d add more tests for error recovery 2024-03-28 22:39:13 -05:00
XeroOl
e47ee55784 shuffle around how encoding works in the tests 2024-03-28 22:38:01 -05:00
XeroOl
7c81ffcbb3 First attempt at code actions, no tests yet 2024-03-26 14:12:34 -05:00
XeroOl
cc05d7089f final attempt at fixing builds.sr.ht 2024-03-04 00:38:47 -06:00
XeroOl
80d0e297a1 more likely pass builds.sr.ht tests 2024-03-04 00:36:53 -06:00
XeroOl
65ea473197 new rockspec to make the luarocks rock work 2024-03-04 00:30:06 -06:00
XeroOl
888689a3a1 Make tests pass on old lua versions 2024-03-03 23:14:22 -06:00
XeroOl
f14d91b9c4
add test for hover over modules 2024-03-03 23:03:31 -06:00
XeroOl
0a766c6425 Finally, documentation for table.insert 2024-03-02 20:12:27 -06:00
XeroOl
308f7d9930 fix broken test 2024-03-02 10:55:15 -06:00
XeroOl
1eb4a770dd Make the multisym splitter tiebreak the right way 2024-03-01 21:36:00 -06:00
XeroOl
cb8dc29bed Analyze (include) the same way as (require) 2024-03-01 17:37:32 -06:00
XeroOl
be997dc7fb add diagnostic test for unknown module field 2024-03-01 17:32:51 -06:00
XeroOl
0dd9c0ff65 improved formatting for destructure 2024-03-01 17:29:01 -06:00
XeroOl
cab3bbc49d remove the dummy test project files 2024-03-01 17:01:10 -06:00
XeroOl
25375715c7 Restore hovering to globals 2024-03-01 16:48:07 -06:00
XeroOl
66bcfc65e5 fix completions for M style modules 2024-03-01 16:39:46 -06:00
XeroOl
45ab692db4 don't warn for symbols hidden in macros 2024-03-01 14:52:23 -06:00
XeroOl
284983657f continue compilation in broken let statements 2024-03-01 14:51:18 -06:00
XeroOl
186c388344 Change tests to faith 2024-03-01 14:43:26 -06:00
XeroOl
418e04edff fix tests to work again 2024-02-24 00:00:33 -06:00
XeroOl
a7d6122670 Fix completion problem in (if) conditions with no body 2024-02-23 23:52:27 -06:00
XeroOl
44805cd675 Add lint for (values) in non-tail position of a call 2024-02-23 12:25:51 -06:00
XeroOl
6152bed8a6 Move json dependency to fennel-ls/json, to represent that it's a modified version 2024-02-19 21:32:38 -06:00
XeroOl
b8565bd146 More language.fnl changes 2024-02-12 21:41:14 -06:00
XeroOl
d3f6d95c09 change the names to be more different 2024-02-11 23:55:05 -06:00
XeroOl
6f9935a781 Fix renames that cover method calls
That was a tough one to debug! I almost thought it was a bug in fennel,
but it, of course, turned out to be a fennel-ls problem.

When you have a symbol like (foo:bar), fennel compiles it by
"macroexpanding" it to (: foo :bar). When fennel macroexpands a macro,
it tries to clean up the output by giving it a best-guess
bytestart/byteend. Fennel-ls was picking up *both* the accurate
`foo:bar` sym and the best-guess virtual `foo` sym as separate
references to `foo`. When computing the renames, the best-guess values
were getting used, which made the replacement range inaccurate.
2024-02-11 23:45:08 -06:00
XeroOl
be5e167d67 very minor fix for completions 2024-02-11 23:11:45 -06:00
XeroOl
3a3b5d38d6 better multisym search, and hover tests to prove it
The search code is getting messy again. I may have to refactor it at
some point.
2024-02-10 01:07:43 -06:00
XeroOl
0e47eee5a4 test: completion edit range testing 2024-02-09 14:15:38 -06:00
XeroOl
3da1e6304b test: add check for unused diagnostic 2024-02-08 12:26:22 -06:00
XeroOl
b6b51698c4 added "セ" character to unicode tests
Although it was properly handled it before, there were no tests for
the unicode offset conversions that used characters that are 3 bytes
in utf8 and 2 bytes in utf16, so I added one. Now, every single
""type"" of charater is tested.
2024-02-03 01:34:41 -06:00
XeroOl
c1f9d43687 added a test for hovering over multival destructure 2024-02-03 01:31:46 -06:00
XeroOl
25e279eda3 completions textEdit initial code 2024-02-03 01:31:27 -06:00
XeroOl
8b6d905450 make multival definition tracking much better
there should now be no cases where multivals and table destructures are
confused. ie, (local [_ x] (values 1 2)) and (local (_ x) [1 2]) are recognized
as nonsense.
2024-02-02 02:12:30 -06:00
XeroOl
297f6c4fa9 fix set rename issue ~xerool/fennel-ls#8
Now unused variables and var-not-set lints use a different system.

References are now of type:
{:symbol sym :target ast :ref-type (or :read :write :mutate)}
instead of ast.

unused var will warn if all the references are :write references.
2024-01-25 00:06:59 -06:00
XeroOl
01035980b0 factoring 2024-01-25 00:06:59 -06:00
XeroOl
b2ec7e5a3a Add debug info to the test 2024-01-25 00:06:51 -06:00
Phil Hagelberg
5055fd31ef Add diagnostic for var-never-set.
This uses the isvar field from the opts map of the destructure hook.
2023-12-06 17:59:26 -06:00
adjuvant
e4ec4dc9c4 Configuration of extra allowed globals 2023-12-03 16:25:54 -06:00
XeroOl
6329fb6ea3 bad-unpack lint warns about (+ (unpack t))
Also, there's a special message for the .. operator to let people know
about table.concat
2023-12-01 14:13:34 -06:00
Phil Hagelberg
5acaac966e Ensure that defining a function on an arg counts as a reference.
Otherwise you get a warning here saying that t is unused:

    (fn f [t x] (fn t.f []) x)
2023-11-26 13:40:20 -06:00
XeroOl
b861812b24 Re-enable the : lint, but with better checks 2023-11-26 12:38:20 -06:00
Phil Hagelberg
c8f9b71057 Add diagnostic warning for unnecessary : call.
When you have a call to the `:` special which could just be a multisym
method call, emit a warning for that.
2023-11-25 18:16:28 -06:00
XeroOl
27d1df23eb Do not warn on fennel rest in function
I kept the test from Tibor Classen's patch, but the code is fixed by
preventing & from ever being a definition, instead of ignoring it only
in the diagnostic.

Co-authored-by: Tibor Claassen <tc@codebeige.net>
2023-11-25 17:55:06 -06:00
XeroOl
824525573a fix a crash
This isn't a great fix, but now finding the definition of a number
doesn't cause a crash.

It used to crash because there's no way to get metadata about the
source-code location of a number.
2023-09-18 17:00:29 -05:00
XeroOl
223976194e textDocument/rename Filter out when symbol references itself
When a symbol is recorded to be its own reference, fennel-ls
accidentally counts the reference twice. That's fine, but we don't want
to replace the same words multiple times
2023-09-16 13:02:14 -05:00
XeroOl
364d02b90d
Better completions for fields of tables
Now it does a two-level-deep search when creating competions for tables,
which means that a completion for module fields have better metadata.
the completion code is a bit of a mess, so I want to look into
refactoring it soon.
2023-09-03 10:23:33 -05:00
adjuvant
31ea7a1039 Allow configuration through initialization options 2023-08-26 20:02:07 -05:00
XeroOl
41a84c5540 fix test for json null 2023-08-21 12:18:26 -05:00
XeroOl
eb1fe781b8 attempt to make the CI more likely to pass 2023-07-20 09:26:36 -05:00
XeroOl
3c2bc8c35c refactor compiler.fnl 2023-07-18 23:53:19 -05:00
XeroOl
ee449df166 Support &as, and ignore & 2023-07-14 10:38:41 -05:00
XeroOl
fe257c061a Add primitive support for renaming 2023-07-13 00:43:16 -05:00
XeroOl
9d534c161f Unused diagnostic now finds functions 2023-07-12 20:43:23 -05:00
XeroOl
5f701d8a6b Remove the word "mock" from the tests so that I feel better about myself
It isn't mocking if you don't call it mocking
2023-07-12 19:07:28 -05:00
XeroOl
1c2a1d3f6a fix bug with top level symbols 2023-07-12 01:29:53 -05:00
XeroOl
b011004988 Support utf16 offsets, and upgrade textdocumentsync to 2 2023-07-12 00:09:30 -05:00
XeroOl
f367914244 shuffle the macro searcher code a little bit ??? 2023-07-09 20:35:04 -05:00
XeroOl
cd37e05e54 Test changes, and fennel-ls now properly negotiates for utf-8 encoding
Unfortunately, fennel-ls still doesn't respect utf-16 rules if the
negotiations fail.
2023-07-09 19:51:20 -05:00
XeroOl
95245726e1 switch more "match" to "case" 2023-07-07 13:40:12 -05:00
XeroOl
21bd635123 treat lambda and λ as function definitions 2023-06-29 12:23:42 -05:00
XeroOl
2c61b5401a Various changes, and fix a searcher crash 2023-06-22 23:28:17 -05:00
XeroOl
3c79f480a8 macro-path and metadata for builtin macros and a couple bug fixes 2023-06-09 01:08:10 -05:00
XeroOl
20b9094592 Added hover and completion for specials
next on the todo list is macros and globals, and then I want to be able
to choose extra globals to add in.
2023-06-03 01:26:07 -05:00
XeroOl
957def8e42 Improve goto-definition 2023-06-02 20:58:02 -05:00
XeroOl
91d4e1e410 Multivals ruining everything 2023-06-02 18:10:35 -05:00
XeroOl
b2c3c04bfe Completions now come with some doc info 2023-06-02 17:34:19 -05:00
XeroOl
a3f787b008 clean up test code 2023-05-29 12:21:36 -05:00
XeroOl
74100ad8ec fix test when running with luajit 2023-05-29 12:19:48 -05:00
XeroOl
5e0a974e30 add some negative test cases for call completions 2023-05-27 21:35:19 -05:00
XeroOl
a1169308d3 completions on multisyms 2023-05-27 21:28:42 -05:00
XeroOl
7f8942fde6 Support completions of x: symbols 2023-05-27 21:10:49 -05:00
XeroOl
deb571092b Only suggest macros/specials in call position
I know that sometimes macros can sometimes take macro/special arguments
in places other than the call position, but I'm not supporting that for
now. If you're writing code like (-> 1 /), the / won't be offered as a
completion suggestion.
2023-05-27 14:14:40 -05:00
XeroOl
a521701dba Fix "unused variable" lint not counting mutating sets as a use 2023-05-26 18:17:15 -05:00
XeroOl
8c33a46d6d fix crash when compiling: (fn undefined.x []) 2023-05-05 16:45:17 -05:00
XeroOl
eab0769b06 Small changes 2023-05-03 00:16:04 -05:00
XeroOl
fbfd7cdaaa Options over LSP
Fennel-ls now can receive options from the language client over the
protocol. Future work still necessary to have project-local files.
2023-05-02 23:55:37 -05:00
XeroOl
f0b6a2672d textDocument/references, and an unused var lint 2023-04-14 16:18:10 -05:00
XeroOl
f157313133 test refactoring 2023-03-27 20:56:03 -05:00
XeroOl
33d080f6c6 Changed test framework to not require outside deps 2023-03-23 14:55:06 -05:00
XeroOl
2eb99a7283 Update fennel to version 1.3.1
There is a new fennel branch on my fork of fennel called extra-hooks-3
which is up to date with fennel 1.3.1 and has the extra hooks necessary
for the server.

Also, some of the error messages need to be updated to match with fennel
1.3.1's changes.
2023-02-22 23:36:14 -06:00
XeroOl
a13483185b
Refactoring and test for path settings 2022-09-23 00:03:10 -05:00
XeroOl
a86c52f33a
Add settings (untested / undocumented) 2022-09-22 00:44:10 -05:00
XeroOl
566b475ff8
refactoring and starting to implement settings 2022-09-21 21:26:55 -05:00
XeroOl
cd4358a4b7
Parse errors are on the correct line number now 2022-09-18 13:05:35 -05:00
XeroOl
5c4d0530f8
consider which part of a multisym the cursor is on
For goto-definition and hovering.
2022-09-17 20:01:25 -05:00
XeroOl
05aa1f7408
Added test for :: crash 2022-09-17 09:24:59 -05:00
XeroOl
06a6e8c7ea
Remove error response when hovering over nothing 2022-09-07 21:19:36 -05:00
XeroOl
0d8b927929
goto-definition with injected fields (fn a.b []) 2022-09-03 12:52:34 -05:00
XeroOl
b2540e53cb
Fixed indirect table field completions 2022-09-03 12:00:46 -05:00
XeroOl
6b642f1d9b
Refactor :?definition to :definition 2022-09-02 18:20:09 -05:00
XeroOl
3cab59622c
The parser is more robust under error 2022-09-01 23:20:38 -05:00
XeroOl
89eb07c064
adjust parents, and take advantage of hooks for better completions 2022-09-01 01:03:59 -05:00
XeroOl
b9d084fada
Upgrade fennel to ~xerool/fennel for extra hooks 2022-09-01 01:02:19 -05:00
XeroOl
69fcd63fad
goto definition understands (let) 2022-08-30 22:30:39 -05:00
XeroOl
82d7913c45
rewrite of find-symbol in preparation for completions 2022-08-28 00:40:46 -05:00
XeroOl
3eeba96188
Refactoring / documentation comments / small fixes 2022-08-24 23:12:28 -05:00
XeroOl
33e938b8db
More README changes 2022-08-20 22:05:09 -05:00
XeroOl
a09035dabc
Refactor 2022-08-19 09:43:58 -05:00
XeroOl
22b4235073
Adds support for hovering over symbols 2022-08-14 23:06:28 -05:00
XeroOl
c2cd1e50fe
Improved goto-definition sifting destructures 2022-08-13 14:20:40 -05:00
XeroOl
44e7158e7d
Somehow even more refactoring 2022-08-09 01:20:58 -05:00
XeroOl
e57833f1e5
more refactoring churn for no reason 2022-08-08 18:11:20 -05:00
XeroOl
f610201b9d
Big refactoring 2022-08-07 22:46:34 -05:00
XeroOl
80d4455ed3
find definition is more advanced but more brittle 2022-08-07 18:47:18 -05:00
XeroOl
61947d3219
Goto definiton for destructuring 2022-08-04 00:33:50 -05:00
XeroOl
42850a76e0
Refactoring 2022-08-02 22:54:29 -05:00
XeroOl
4847179afd
Created a compiler plugin, local go-to-definition 2022-08-02 18:18:03 -05:00
XeroOl
052f9a67d0
reduce the prevelance of penlight 2022-08-01 18:21:27 -05:00
XeroOl
680e4a6485
More progress on the language server 2022-08-01 13:09:05 -05:00
XeroOl
db59350a1c
go-to-definition for require with fixed module name 2022-07-30 23:58:12 -05:00
XeroOl
3c91ad0680
More progress 2022-07-30 01:30:01 -05:00
XeroOl
9815dae79d
Test rework, and more file tests 2022-07-29 00:08:14 -05:00
XeroOl
792713ab2a
more content 2022-07-28 19:11:18 -05:00