LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.32k stars 311 forks source link

Large Lua files have "Not showing N further errors and warnings" #1555

Open Zamiell opened 2 years ago

Zamiell commented 2 years ago

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Problem

Related to: #1522

In large files, you can get into a situation where there are 0 errors reported in the errors pane except for "Not showing N further errors and warnings". Obviously, this makes it impossible to actually fix the errors, since you don't know what they are.

Thus, the bug seems to be that the Lua language server is incorrectly ignoring errors suppressed by the end-user, since they are still counting towards the 250 hardcoded (?) VSCode limit

Reproduction steps

Use the following Lua file:

https://gist.github.com/Zamiell/d0ab9f0b9d0d48efe9a14c293e44f8f0/raw/272057baf5028400e2aefed958b8d31defb01f02/main.lua

With the following .luarc.json file:

{
  "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
  "diagnostics.globals": [
    "ActionTriggers",
    "ActiveSlot",
    "BabySubType",
    "BackdropType",
    "BatterySubType",
    "BedSubType",
    "BitSet128",
    "BombSubType",
    "BombVariant",
    "ButtonAction",
    "CacheFlag",
    "Card",
    "Challenge",
    "ChampionColor",
    "ChestSubType",
    "CoinSubType",
    "CollectibleType",
    "Color",
    "CppContainer",
    "DamageFlag",
    "Difficulty",
    "Direction",
    "DoorSlot",
    "DoorState",
    "DoorVariant",
    "EffectVariant",
    "Entity",
    "EntityBomb",
    "EntityCollisionClass",
    "EntityEffect",
    "EntityFamiliar",
    "EntityFlag",
    "EntityGridCollisionClass",
    "EntityKnife",
    "EntityLaser",
    "EntityNPC",
    "EntityPartition",
    "EntityPickup",
    "EntityPlayer",
    "EntityProjectile",
    "EntityPtr",
    "EntityRef",
    "EntityTear",
    "EntityType",
    "FamiliarVariant",
    "Font",
    "Game",
    "GameStateFlag",
    "GetPtrHash",
    "GridCollisionClass",
    "GridEntity",
    "GridEntityDesc",
    "GridEntityDoor",
    "GridEntityPit",
    "GridEntityPoop",
    "GridEntityPressurePlate",
    "GridEntityRock",
    "GridEntitySpikes",
    "GridEntityTNT",
    "GridEntityType",
    "GridRooms",
    "HUD",
    "HeartSubType",
    "Input",
    "InputHook",
    "Isaac",
    "ItemConfig",
    "ItemPool",
    "ItemPoolType",
    "ItemType",
    "KColor",
    "KeySubType",
    "Keyboard",
    "LaserOffset",
    "LaserSubType",
    "Level",
    "LevelCurse",
    "LevelStage",
    "LevelStateFlag",
    "LocustSubtypes",
    "ModCallbacks",
    "Mouse",
    "Music",
    "MusicManager",
    "NpcState",
    "NullItemID",
    "Options",
    "PathFinder",
    "PickupPrice",
    "PickupVariant",
    "PillColor",
    "PillEffect",
    "PlayerForm",
    "PlayerSpriteLayer",
    "PlayerType",
    "PlayerTypes",
    "PoopPickupSubType",
    "PoopSpellType",
    "ProjectileFlags",
    "ProjectileParams",
    "ProjectileVariant",
    "QueueItemData",
    "REPENTANCE",
    "RNG",
    "Random",
    "RandomVector",
    "RegisterMod",
    "RenderMode",
    "Room",
    "RoomConfig",
    "RoomDescriptor",
    "RoomShape",
    "RoomTransitionAnim",
    "RoomType",
    "SFXManager",
    "SackSubType",
    "SeedEffect",
    "Seeds",
    "ShockwaveParams",
    "SkinColor",
    "SortingLayer",
    "SoundEffect",
    "Sprite",
    "StageType",
    "StartDebug",
    "TearFlags",
    "TearParams",
    "TearVariant",
    "TemporaryEffect",
    "TemporaryEffects",
    "TrinketType",
    "UseFlag",
    "Vector",
    "WeaponType",
    "AwaitingTextInput",
    "EID",
    "Encyclopedia",
    "ModConfigMenu",
    "MinimapAPI",
    "StageAPI",
    "g",
    "gd",
    "getParentFunctionDescription",
    "sandboxGetTraceback",
    "sandboxTraceback"
  ],
  "preloadFileSize": 5000,
  "runtime.version": "Lua 5.3"
}

Then, you will see that there are Not showing 2551 further errors and warnings. in the "Problems" pane of VSCode.

carsakiller commented 2 years ago

Do you have any other extensions on that may be contributing other warnings/errors? I am unable to replicate. I am given many warnings and errors before receiving the “Not showing…” message.

image

Zamiell commented 2 years ago

As per your suggestion, I tried disabling all extensions except for the Sumneko one. But something weird seems to be happening.

Open opening the "main.lua" file included in my OP, I get these errors:

image

They seem to be relating to files inside of the sumneko extension itself. Do you know why this is happening?

Zamiell commented 2 years ago

Never-mind my previous comment; I had a problem relating to using a temp extensions subdirectory of the CWD.

Anyways, I am still not able to reproduce your results even with the sumneko extension being on the only extension installed.

Specifically, I am using the following command to launch VSCode:

code . --extensions-dir ../temp/vscode/ --user-data-dir ../temp/vscode/

Then, I install the Sumneko extension (because it starts with everything vanilla with no extensions installed).

Then, I open up main.lua, and I get this:

image

Zamiell commented 2 years ago

If it matters, I am on Windows 10:

image

4grabs commented 2 years ago

I also downloaded the main.lua file that is provided in the OP and I get the same problem as Zamiel image

I am also on Windows 10.

sumneko commented 2 years ago

This is because some low-level diagnostics are not displayed in the window, such as unused-local, tail-space

Zamiell commented 2 years ago

Why are they not being displayed? Is the language server bugged?

sumneko commented 2 years ago

There are 4 levels of diagnostics: error, warning, information, hint. The diagnostics of hint level are not displayed in the problems window.

Zamiell commented 2 years ago

I see. Why is the Lua language server outputting hints? Can we change it so that it doesn't use any hints at all?

sumneko commented 2 years ago

I see. Why is the Lua language server outputting hints? Can we change it so that it doesn't use any hints at all?

Use diagnostics.groupSeverity or diagnostics.severity