nvim/TEST_DIAGNOSTICS.md
ray dd8cc0eaf2 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.
2025-12-11 23:05:26 +00:00

2.9 KiB

LSP Diagnostic Test Files

These files are designed to trigger LSP diagnostics of all types to test the Paper Tonic Modern colorscheme's diagnostic virtual text colors.

Test Files

test-diagnostics.lua

Lua file with intentional errors for lua_ls (Lua Language Server).

Expected diagnostics:

  • Errors (red): Undefined variables/functions, type mismatches, invalid operations, wrong argument counts
  • Warnings (orange): Unused variables, shadowing, unreachable code, lowercase globals
  • Hints (green): Redundant code, style issues

Note: lua_ls provides the best mix of diagnostic levels.

test-diagnostics.php

PHP file with intentional errors for Intelephense (PHP Language Server).

Expected diagnostics:

  • Errors (red): Most issues appear as errors by default in Intelephense
    • Undefined functions/variables
    • Type mismatches
    • Wrong argument counts
    • Invalid method calls

Note: Intelephense is strict and reports most issues as errors. To see warnings/hints, configure in .nvim.lua:

return {
  lsp = {
    intelephense = {
      settings = {
        intelephense = {
          diagnostics = {
            undefinedSymbols = true,
            undefinedVariables = true,
            unusedSymbols = "hint",  -- Show unused as hints
          }
        }
      }
    }
  }
}

test-diagnostics.js

JavaScript file with intentional errors for ts_ls (TypeScript Language Server).

Expected diagnostics:

  • Errors (red): Undefined variables/functions, invalid property access, missing parameters
  • Warnings (orange): Unreachable code, type comparison issues, duplicate cases
  • Hints (green): const vs let suggestions
  • Info (blue): Unnecessary operations

How to Use

  1. Open any test file in Neovim:

    nvim test-diagnostics.lua
    # or
    nvim test-diagnostics.php
    # or
    nvim test-diagnostics.js
    
  2. Wait for LSP to attach and analyze the file (1-2 seconds)

  3. Check the virtual text diagnostics at the end of lines with issues

  4. Use :LspInfo to verify the LSP server is attached

Color Reference

The Paper Tonic Modern colorscheme uses these colors for diagnostics:

  • DiagnosticError (virtual text): #d70000 (bright red) on #ffefef background
  • DiagnosticWarn (virtual text): #d75f00 (orange) on #ece0e0 background
  • DiagnosticInfo (virtual text): #8989af (blue) on #e0e0ec background
  • DiagnosticHint (virtual text): #89af89 (green) on #e0ece0 background

Testing Checklist

  • Errors show in red with red undercurl
  • Warnings show in orange with orange undercurl
  • Hints show in green
  • Info messages show in blue
  • Virtual text is readable against light background
  • Sign column icons show correct colors
  • Diagnostic floating windows display correctly

Debug Command

Use the <leader>hi keymap to inspect highlight info under cursor and verify diagnostic colors are applied correctly.