diff options
author | AndreaWalchshoferSCCH <122894794+AndreaWalchshoferSCCH@users.noreply.github.com> | 2023-03-30 15:52:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 15:52:53 +0200 |
commit | 4eb508f5390b3de5aeb59e9e6cb5c0742c9ee97b (patch) | |
tree | 47b4b4583aefd4693cde2395ab063c0e96a8f27c /script/core | |
parent | 43794193ef981ffecb477bfce444428ded852aa0 (diff) | |
download | lua-language-server-4eb508f5390b3de5aeb59e9e6cb5c0742c9ee97b.zip |
Revert "Add diagnostic to enforce lowercase local element names (#2)" (#5)
This reverts commit 43794193ef981ffecb477bfce444428ded852aa0.
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/diagnostics/uppercase-local.lua | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/script/core/diagnostics/uppercase-local.lua b/script/core/diagnostics/uppercase-local.lua deleted file mode 100644 index cc377dd2..00000000 --- a/script/core/diagnostics/uppercase-local.lua +++ /dev/null @@ -1,47 +0,0 @@ -local files = require 'files' -local guide = require 'parser.guide' -local lang = require 'language' - -local function isDocClass(source) - if not source.bindDocs then - return false - end - for _, doc in ipairs(source.bindDocs) do - if doc.type == 'doc.class' then - return true - end - end - return false -end - --- If local elements must be named lowercase by coding convention, this diagnostic helps with reminding about that -return function (uri, callback) - local ast = files.getState(uri) - if not ast then - return - end - - guide.eachSourceType(ast.ast, 'local', function (source) - local name = guide.getKeyName(source) - if not name then - return - end - local first = name:match '%w' -- alphanumeric character - if not first then - return - end - if not first:match '%u' then -- uppercase - return - end - -- If the assignment is marked as doc.class, then it is considered allowed - if isDocClass(source) then - return - end - - callback { - start = source.start, - finish = source.finish, - message = lang.script('DIAG_UPPERCASE_LOCAL', name), - } - end) -end |