Skip to content

implement a tool to resolve workspace symbols based on a query #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2025

Conversation

jakemac53
Copy link
Contributor

This allows you to ask things like "Tell me about in my project" and it will tell you where it is located.

Follow on features will allow for looking up more detailed information about the symbol such as its doc comments and API.

Copy link

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

@visibleForTesting
static final resolveWorkspaceSymbolTool = Tool(
name: 'resolve_workspace_symbol',
description: 'Resolves a given symbol or symbols in a workspace.',
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be more descriptive for an LLM to know what this does? This reads like only someone familiar with static analysis will understand what this tool does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, I was wondering about that but I have tried a few different prompts and it seems to understand. I think the LLM was trained on enough people familiar with static analysis that it actually "understands" this prompt well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this a bit, PTAL


@visibleForTesting
static final resolveWorkspaceSymbolTool = Tool(
name: 'resolve_workspace_symbol',
Copy link
Contributor

Choose a reason for hiding this comment

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

same question WRT the tool name. Should this be understandable by a human trying to decide whether to approve or deny the use of this tool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the newest API version there is an additional field called "title" so I could add a user friendly title under there?

We should probably do this to all the tools

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tool annotations to give it a better name, PTAL

description: 'Resolves a given symbol or symbols in a workspace.',
inputSchema: Schema.object(
properties: {
'query': Schema.string(title: 'The query for the symbol(s) to look up'),
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not clear to me what the query will look like. How will the LLM know what this should look like? Can we add an example in comments here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The LSP spec doesn't have any sort of definition I could find, cc @bwilkerson who might know what is actually supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, this just does a "fuzzy match" by exact name. So it allows for typos but not any sort of patterns or path queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a description after talking with Danny and Brian, PTAL

@jakemac53 jakemac53 requested a review from kenzieschmoll April 23, 2025 17:45
@jakemac53 jakemac53 merged commit a5089bf into main Apr 24, 2025
13 checks passed
@jakemac53 jakemac53 deleted the symbol-usage branch April 24, 2025 22:27
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.

2 participants