Skip to content

Rework GDScriptExtendParser into LSPParseResult and don't use inheritance - #123547

Open
HolonProduction wants to merge 1 commit into
godotengine:masterfrom
HolonProduction:dont-extend-parser
Open

HolonProduction wants to merge 1 commit into
godotengine:masterfrom
HolonProduction:dont-extend-parser

Conversation

@HolonProduction

Copy link
Copy Markdown
Member

What problem(s) does this PR solve?

  • The LSP has a GDScriptParser subclass, however there isn't really any reason to use inheritance since it does not override anything. It just parses normally and then processes the results. This PR replaces the inheritance relationship with just having a GDScriptParser
  • Fixes some IMO architectural debt, but primarily the fact that GDScriptParser has subclasses has been an issue for something I'm working on (reworking ownership and management of external parser i.e. replacing GDScriptParserRef) and it made sense to split this out since it is a self contained change.

Additional information

I've started addressing AST nodes using an AST typedef (so AST::ClassNode over GDScriptParser::ClassNode). This IMO helps with readability.

@AThousandShips

Copy link
Copy Markdown
Member

Should it not be named LSPParseResult? Like LSPErrorCode and the namespace

@HolonProduction HolonProduction changed the title Rework GDScriptExtendParser into LspParseResult and don't use inheritance Rework GDScriptExtendParser into LSPParseResult and don't use inheritance Sep 17, 2026

@Ivorforce Ivorforce left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good, but I'd separate the AST change.

#include "gdscript_language_protocol.h"
#include "gdscript_workspace.h"

using AST = GDScriptParser;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? It seems unrelated to the PR and causes most of the churn. I'd rather sign it off separately.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change already had a lot of churn from adding missing GDScriptParser:: qualifications, so I felt doing it now was better then churning through the full file again later.

But when I made this I was planing to slowly trickle the rename in. With #125641 it doesn't really matter either way.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants