Add LSP diagnostic test files for multiple languages

Includes test files for Lua, JavaScript, PHP to verify the Paper Tonic
Modern colorscheme's diagnostic virtual text colors across different
LSPs and their expected diagnostics.
This commit is contained in:
Ray Elliott 2025-12-11 23:05:26 +00:00
commit dd8cc0eaf2
4 changed files with 320 additions and 0 deletions

84
test-diagnostics.lua Normal file
View file

@ -0,0 +1,84 @@
-- Test file for LSP diagnostics - lua_ls
-- This file intentionally contains different diagnostic levels
-- to test diagnostic virtual text colors in paper-tonic-modern
-- Define some valid code first
local valid_function = function()
return "valid"
end
---@diagnostic disable-next-line: unused-local
local _ = valid_function()
-- ERROR: Undefined global (lua_ls marks this as error)
print(undefined_global_variable)
-- ERROR: Undefined function
undefined_function()
-- WARNING: Unused local variable (lua_ls warning level)
local unused_variable = "I'm never used"
-- WARNING: Lowercase global (should be local)
lowercase_global = "This should be local or uppercase"
-- HINT: Redundant parentheses (some configs treat as hint)
local x = (5)
print(x)
-- ERROR: Wrong number of arguments
local function takes_two_args(a, b)
return a + b
end
takes_two_args(1) -- Missing second argument (lua_ls error)
-- ERROR: Attempting to call a non-function
local not_a_function = "string"
not_a_function()
-- WARNING: Shadowing outer local
local shadow_me = 1
do
local shadow_me = 2 -- Shadows outer local (warning)
print(shadow_me)
end
-- ERROR: Invalid table access
local empty_table = {}
print(empty_table.nonexistent.deeply.nested.property)
-- WARNING/HINT: Can be simplified
if true == true then -- Redundant comparison
print("always true")
end
-- ERROR: Type annotation mismatch
---@type string
local should_be_string = 123 -- Assigning number to string type
-- WARNING: Unreachable code after return
local function has_dead_code()
return "done"
print("This will never execute") -- Unreachable
end
-- Valid function call
print(takes_two_args(1, 2))
-- ERROR: Calling vim API that doesn't exist
vim.nonexistent_function()
-- HINT: Trailing whitespace or style issues (if configured)
local with_trailing_space = "value"
print(with_trailing_space)
-- ERROR: Parameter type mismatch
---@param name string
---@param age number
local function greet(name, age)
print("Hello, " .. name .. ", you are " .. age)
end
greet(123, "not a number") -- Wrong types
print("Diagnostic test complete!")