Skip to content
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

Fix ${workspaceFolder} being added to browse.path if ${workspaceFolder}/* is used. #13324

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sean-mcmanus
Copy link
Contributor

@sean-mcmanus sean-mcmanus commented Feb 28, 2025

This was working with 1.16.3, but then some change caused the ${workspaceFolder} variable to be resolved before it checked for ${workspaceFolder} at this spot, so the regex match would always fail. This just fixes it so that the previously working case works now.

@sean-mcmanus sean-mcmanus requested a review from a team as a code owner February 28, 2025 21:05
@sean-mcmanus sean-mcmanus changed the title Fix ${workspaceFolder} being added if ${workspaceFolder}/* is used. Fix ${workspaceFolder} being added to browse.path if ${workspaceFolder}/* is used. Feb 28, 2025
@@ -998,10 +998,15 @@ export class CppProperties {
} else if (configuration.includePath) {
// If the user doesn't set browse.path, copy the includePath over. Make sure ${workspaceFolder} is in there though...
Copy link
Contributor

Choose a reason for hiding this comment

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

After my current PR on the native side goes in, I want to remove this section, making it the responsibility of the native side to populate the browse paths with the include paths, if the browse path is undefined. That way, I can ensure any include paths ingested via compiler arguments get into the browse path also (if not explicitly set). Since this would be removed soon (before the next insiders, if possible), maybe this fix isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Colengms Sure, yeah, it sounds like this won't be needed.

!!value.match(/^\$\{(workspaceRoot|workspaceFolder)\}(\\\*{0,2}|\/\*{0,2})?$/g)) === -1
) {
configuration.browse.path.push("${workspaceFolder}");
if (this.rootUri) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we know if this behavior changed due to a change in vscode itself, or something else?

if it was a change in vscode, did we want to still make it work with (workspaceRoot|workspaceFolder) as well in case the newer extension was run on an older version of vscode?

Copy link
Member

Choose a reason for hiding this comment

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

It needs to continue to work with ${workspaceFolder}/** because that's the default entry for includePath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fearthecowboy @bobbrow The change is that this the ${workspaceFolder} variable is resolved at this point by our own code due to calls to the resolveVariable or whatever it's called.

Copy link
Member

Choose a reason for hiding this comment

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

resolveVariables does not resolve ${workspaceFolder}. That happens in the native code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bobbrow No, that changed. It resolves it in TypeScript. That's what I saw when I debugged it.

@sean-mcmanus sean-mcmanus marked this pull request as draft March 3, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pull Request
Development

Successfully merging this pull request may close these issues.

4 participants