-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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... | ||
configuration.browse.path = configuration.includePath.slice(0); | ||
if (configuration.includePath.findIndex((value: string) => | ||
!!value.match(/^\$\{(workspaceRoot|workspaceFolder)\}(\\\*{0,2}|\/\*{0,2})?$/g)) === -1 | ||
) { | ||
configuration.browse.path.push("${workspaceFolder}"); | ||
if (this.rootUri) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It needs to continue to work with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fearthecowboy @bobbrow The change is that this the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Called by updateConfigurationPathsArray, which is called by updateServerOnFolderSettingsChange, which is the function that was modified in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bobbrow I recall Colen talking about changing it to not send ${workspaceFolder} to the cpptools side and resolving it on the TypeScript side instead, since it wasn't necessary keep ${workspaceFolder} around. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I'm not sure when that changed, but I suppose if it has, then yes this code will need to be updated to deal with it. But I think it doesn't make a lot of sense to be inserting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bobbrow Sure, but my PR just fixes it so that it doesn't add ${workspaceFolder} -- the pre-existing behavior already adds workspace folder. And note I've moved this to draft since Colen says one of his pending PRs would be causing this code to not be used so it might not be needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The native side will resolve variables ( |
||
const normalizedRootUriFsPath: string = escapeStringRegExp(this.rootUri.fsPath.replace(/\\/g, "/")); | ||
const regexPattern = `^${normalizedRootUriFsPath}(\\*{0,2}|\/\\*{0,2})?$`; | ||
const regex = new RegExp(regexPattern, "g"); | ||
if (configuration.includePath.findIndex((value: string) => | ||
!!value.match(regex)) === -1 | ||
) { | ||
configuration.browse.path.push("${workspaceFolder}"); | ||
} | ||
} | ||
} else { | ||
configuration.browse.path = ["${workspaceFolder}"]; | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.