-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: Fragment identifier full line ignore #2626
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
base: develop
Are you sure you want to change the base?
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,16 +12,22 @@ const cached = {}; | |||||
| * | ||||||
| * @param {string} text - The input text that may contain embedded fragments. | ||||||
| * @param {string} fragment - The fragment identifier to search for. | ||||||
| * @param {boolean} fullLine - The fragment identifier to search for. | ||||||
| * @returns {string} - The extracted and demented content, or an empty string if not found. | ||||||
|
||||||
| * @returns {string} - The extracted and demented content, or an empty string if not found. | |
| * @returns {string} - The extracted and dedented content, or an empty string if not found. |
Copilot
AI
Nov 11, 2025
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.
The regex pattern is incorrect when fullLine is false. This pattern matches either ### alone OR /// followed by \\s*[fragment], but it doesn't match ### followed by \\s*[fragment]. The pattern should be wrapped in a non-capturing group: let fragmentRegex = (?:###|\/\/\/)\s*\[${fragment}\]; to match either ### or ///, then \\s*[fragment].
| let fragmentRegex = `###|\\/\\/\\/\\s*\\[${fragment}\\]`; | |
| let fragmentRegex = `(?:###|\\/\\/\\/)\\s*\\[${fragment}\\]`; |
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.
True. However, this isn’t the final regex string. The non-capture group part is added just below this line
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.
The parameter description for
fullLineis incorrect. It should describe that this is a boolean flag to enable full-line matching of fragment identifiers, not 'The fragment identifier to search for' (which is the description for thefragmentparameter).