Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Add Just My Code support for global symbol search #823

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

harikrishnan94
Copy link

@harikrishnan94 harikrishnan94 commented Oct 26, 2018

Just my code option filters all non workspace symbols returned to client

src/config.h Outdated Show resolved Hide resolved
src/config.h Outdated Show resolved Hide resolved
@@ -232,13 +232,21 @@ struct Config {
};
Index index;

// List of folders opened in current workspace.
std::vector<std::string> workspaceFolders;
Copy link
Owner

Choose a reason for hiding this comment

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

This probably shouldn't be in config, can you store it as a variable in the base message handler class?

Copy link
Author

Choose a reason for hiding this comment

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

Hmmm..
Don't know how to achieve this. Okay, let me put forth my understanding of LSP.

  • There are only two ways to receive config options from clients.
    1. Through initialization options - stored in struct Config.
    2. Through --init command line option - can be stored in strut MessageHandler or in one of its fields.
  • Clients don't (can't) send extra options through queries.

Please, correct me if I'm wrong regarding these assumptions.

Coming to the change you suggested, did you mean struct MessageHandler or struct BaseMessageHandler.
In either case please elaborate on how to achieve this. Thanks.

Copy link
Owner

Choose a reason for hiding this comment

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

In MessageHandler, ie, where db, project and the like are defined (src/message_handler.h line 85ish). You can declare a std::unique_ptr<std::vector<std::string>> workspaceFolders there and append to it inside of init, ie, so that every derived MessageHandler type will use the same std::vector instance.

Copy link
Owner

Choose a reason for hiding this comment

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

Let me know if you don't feel like doing that, a TODO is good enough.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, for clarification. I've made the changes you suggested. Check if that is what you intended.
Please feel free to suggest further changes.

@jacobdufault
Copy link
Owner

Thanks! This seems like a nice improvement, what about we just make this standard behavior and add an option to disable the automatic filtering in settings?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants