Skip to content

Enhance open.mp support: autocomplete, hover docs, syntax highlighting, snippets, and compiler integration - #20

Open
stefanutc1 wants to merge 3 commits into
openmultiplayer:masterfrom
stefanutc1:openmp-improvements
Open

Enhance open.mp support: autocomplete, hover docs, syntax highlighting, snippets, and compiler integration#20
stefanutc1 wants to merge 3 commits into
openmultiplayer:masterfrom
stefanutc1:openmp-improvements

Conversation

@stefanutc1

Copy link
Copy Markdown

This PR introduces several quality-of-life and IntelliSense improvements for open.mp and modern Pawn development:

Summary of Changes

  1. Autocomplete & Hover Documentation:

    • Added a built-in data dictionary containing comprehensive documentation, signatures, parameter descriptions, and return values for open.mp and standard SA-MP natives, callbacks, and constants.
    • Enhanced doHover and doSignHelp to show rich Markdown tooltips and active parameter hints.
    • Improved symbol parsing to handle Pawn tags (Float:, bool:, PlayerText:, etc.) and command definitions (CMD:, YCMD:) without losing definition references.
    • Allowed multi-word macro expressions in #define parsing.
  2. Syntax Highlighting & Tokenization:

    • Refined preprocessor rules in Pawn.tmLanguage to properly recognize #elif, diagnostic directives (#error, #warning), and extended #pragma flags (warning, option, compatibility, disablestate, naked, reparse).
    • Added highlighting for modern storage types, modifiers, and built-in open.mp tags (bool, Float, File, Text, Text3D, PlayerText, PlayerText3D, Menu, DB, DBResult, Bit, Iterator, Task, Timer, Group, BitArray, ConstString, struct, decl).
    • Added highlighting for command macros (CMD:, COMMAND:, YCMD:, flags:), operators (sizeof, tagof, defined), control keywords (foreach, yield), and language constants.
  3. Code Snippets:

    • Added a dedicated snippets/pawn.json catalog registered in package.json with snippets for:
      • Common callbacks (OnPlayerConnect, OnPlayerDisconnect, OnPlayerSpawn, OnPlayerDeath, OnDialogResponse, OnPlayerWeaponShot, etc.).
      • Fast command skeletons (CMD:, YCMD:, admin commands with permission checks).
      • Performance-optimized pool loops using GetPlayerPoolSize(), GetVehiclePoolSize(), and GetActorPoolSize(), as well as foreach iterators.
      • Include guards and ALS hook patterns.
  4. Compiler Integration & Problem Matcher:

    • Fixed invalid trailing commas in the generated tasks.json template in src/client/task.ts.
    • Updated the $pawncc problem matcher in package.json with a more flexible regular expression that accurately parses standard compiler output, column numbers, warning/error codes, and line ranges.
    • Configured fileLocation to "autoDetect" so compiler diagnostics map to the exact file and line directly in the VS Code Problems panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant