feat(lsp): add xgoGetProperties command for lsp#2837
feat(lsp): add xgoGetProperties command for lsp#2837go-wyvern wants to merge 2 commits intogoplus:devfrom
Conversation
Summary of ChangesHello @go-wyvern, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Language Server Protocol (LSP) integration by introducing a new command that allows clients to query for properties (fields and methods) of specific targets within the SPX project. This feature improves the editor's ability to provide richer contextual information, paving the way for more advanced code intelligence features like auto-completion and documentation lookups for game objects and sprites. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
…ndXGoGetProperties
There was a problem hiding this comment.
Pull request overview
Adds a new SPX LSP workspace command (xgo.getProperties) to the GUI-side client/command typings so the editor can request target properties (e.g., for API reference/intellisense features).
Changes:
- Added
xgoGetPropertiescommand definition (arguments/result typing) inspxls/commands.ts. - Added a corresponding
SpxLSPClientwrapper method to execute the command viaworkspace/executeCommand. - Updated imports to include the new command.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
spx-gui/src/components/editor/code-editor/lsp/spxls/commands.ts |
Defines the new xgo.getProperties command and its argument/result types. |
spx-gui/src/components/editor/code-editor/lsp/index.ts |
Exposes a SpxLSPClient wrapper to execute the new command and updates imports accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces a new LSP command xgoGetProperties to fetch properties for a given target. The implementation looks good, but I have a couple of suggestions to improve consistency and robustness.
First, the new method in SpxLSPClient is named workspaceExecuteCommandXGoGetProperty (singular), which is inconsistent with the command itself and other similar methods. I've suggested renaming it to the plural form workspaceExecuteCommandXGoGetProperties.
Second, the result type for the new command is defined as XGoProperty[], while other similar commands can return null. To prevent potential runtime errors and maintain consistency, I've recommended changing the result type to XGoProperty[] | null.
|
|
||
| async textDocumentDocumentLink( | ||
| ctx: RequestContext, | ||
| params: lsp.DocumentLinkParams |
There was a problem hiding this comment.
Missing Convenience Method: Consider adding a higher-level getProperties wrapper method following the established pattern in this codebase.
Existing patterns:
getInputSlots(line 428) wrapsworkspaceExecuteCommandXGoGetInputSlotsgetCompletionItems(line 421) wrapstextDocumentCompletiongetResourceReferences(line 389) wrapstextDocumentDocumentLink
Suggested implementation:
async getProperties(ctx: RequestContext, target: string): Promise<xgoGetProperties.XGoProperty[]> {
const result = await this.workspaceExecuteCommandXGoGetProperties(ctx, { target })
if (result == null) return []
return result
}This would provide a cleaner API and improve maintainability.
Code Review SummaryReviewed this PR adding the Critical:
Recommended:
Overall solid implementation, just needs consistency fixes. |
nighca
left a comment
There was a problem hiding this comment.
建议先不合入,等对应的更新 ls 版本的改动一起合入
No description provided.