From 32350ec44bf2504183a823718bff72f1e321bfc6 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 28 Feb 2025 04:18:36 -0800 Subject: [PATCH] Recognize deprecated functions that haven't been removed yet. --- TODO.md | 8 ++++---- src/fennel-ls/docs.fnl | 6 ++++++ test/diagnostic.fnl | 7 ++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 8c1ed0b..ef6edcf 100644 --- a/TODO.md +++ b/TODO.md @@ -22,6 +22,10 @@ refactor brainstorm: Here is my feature wishlist. I don't expect to ever get all of this done, but these are the sort of enhancements I am thinking about. +- [ ] Improved global checks + - [ ] (or table.unpack _G.unpack) should be allowed on any Lua version +- [ ] generate man page +- [ ] load lints from external sources (sandboxed) - [X] Able to connect to a client - [X] Support for UTF-8 characters that aren't just plain ASCII. (especially `λ`) (perhaps just tell the IDE that I want to communicate with utf-8 offsets) - [ ] People have tried fennel-ls in: @@ -30,10 +34,6 @@ done, but these are the sort of enhancements I am thinking about. - [X] helix - [X] vscode (publish an extension) - [ ] vim+coc (publish a node thingy) -- [ ] Improved global checks - - [ ] (or table.unpack _G.unpack) should be allowed on any Lua version -- [ ] generate man page -- [ ] load lints from external sources (sandboxed) - [x] Go-to-definition: - [X] literal table constructor - [X] table destructuring diff --git a/src/fennel-ls/docs.fnl b/src/fennel-ls/docs.fnl index a7240d7..25a02da 100644 --- a/src/fennel-ls/docs.fnl +++ b/src/fennel-ls/docs.fnl @@ -37,6 +37,12 @@ (set lua-versions.lua51.package.fields.config lua-versions.lua52.package.fields.config) +;; deprecated but not removed +(each [_ f (ipairs [:atan2 :cosh :sinh :tanh :pow :frexp :ldexp])] + (set (. lua-versions.lua53.math.fields f) (. lua-versions.lua52.math.fields f))) + +(set lua-versions.lua53.bit32 lua-versions.lua52.bit32) + (each [_ version (pairs lua-versions)] (each [k v (pairs version)] (set (. lua-versions.union k) v))) diff --git a/test/diagnostic.fnl b/test/diagnostic.fnl index b2e42c2..3d953e1 100644 --- a/test/diagnostic.fnl +++ b/test/diagnostic.fnl @@ -155,7 +155,12 @@ [] [{:message "unknown identifier: unpack"} {:message "unknown identifier: warn"}] - {:lua-version "union"})) + {:lua-version "union"}) + ;; deprecated functions still work + (check "(print (math.atan2 (tonumber (io.read))))" + [] + [{:message "unknown field: math.atan2"}] + {:lua-version "lua5.3"})) {: test-lua-versions : test-compile-error