-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 broken regex on "src/services/completions.ts#getCompletionData" #37546
fix broken regex on "src/services/completions.ts#getCompletionData" #37546
Conversation
I wrote thanks |
983bbf1
to
5b9da77
Compare
Couple of questions (that would normally be answered in a bug filed separately)
I'll try to take a look at the code when I have a chance. |
@sandersn Hi, thanks for your precious time :-)
Sorry, could not in a sentence or two :- First,
1. expected vs actual behaviour
2. How long has this been broken
Yes, it doesn't seem to have changed since then. I discovered about a year ago by LGTM - microsoft/TypeScript. Few people can immediately judge Since the jsdoc is formatted appropriately by the complement feature of tsserver(?), thanks |
a0160dd
to
0bcf716
Compare
0bcf716
to
b355a34
Compare
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.
Looks good, I just want to understand how you were able to stop returning JsDocTagName when inside brackets. Was this code always wrong?
cc5f790
to
8dfc253
Compare
@sandersn I'm sorry, my English reading ability is low and it is difficult to explain without misunderstanding 😭 |
breaking changes fourslash test Temporarily retain the before fix code for easy comparison
fourslash test
@sandersn Originally I wanted to fix only
However, if only modify the // Result of removing duplicate characters in regex class set part.
// Also, in this case, the `test` method is preferable to the `match` method, right?
if (!/[^\*|\s(/)]/.test(sourceFile.text.substring (lineStart, position))) {
return {kind: CompletionDataKind.JsDocTag};
} looks like above. I suggest this fix. |
8dfc253
to
3f1bb2d
Compare
As-is, I think this is a nice cleanup of a misleading regex. However, could you make another PR with your other fix? It looked useful too. (No problem if you do not have time, we are happy for any contribution.) |
* upstream/master: (54 commits) LEGO: check in for master to temporary branch. LEGO: check in for master to temporary branch. Fix for jsdoc modifiers on constructor params (microsoft#38403) Improve assert message in binder (microsoft#38270) fix broken regex on "src/services/completions.ts#getCompletionData" (microsoft#37546) report error for duplicate @type declaration (microsoft#38340) fix(38073): hide 'Extract to function in global scope' action for arrow functions which use 'this' (microsoft#38107) Update user baselines (microsoft#38472) Update user baselines (microsoft#38405) Changed template strings to emit void 0 instead of undefined (microsoft#38430) Fix js missing type arguments on existing nodes and jsdoc object literal declaration emit (microsoft#38368) LEGO: check in for master to temporary branch. Make isDynamicFileName available publicly (microsoft#38269) LEGO: check in for master to temporary branch. LEGO: check in for master to temporary branch. Exclude arrays and tuples from full intersection property check (microsoft#38395) Fix crash caused by assertion with evolving array type (microsoft#38398) Update user baselines (microsoft#38128) LEGO: check in for master to temporary branch. moveToNewFile: handle namespace imports too ... # Conflicts: # src/compiler/types.ts # src/compiler/utilities.ts
@sandersn I am happy that this PR has been applied :-)
In parallel with this PR, I was creating and developing a branch to support the completion of the inline jsdoc tag. Can almost certainly control the completion of the inline jsdoc tag, Also, I think that PR regarding strict application of jsdoc tag completion will be proposed collectively if there is time. thanks |
Currently TS doesn't understand inline jsdoc tags. It explicitly skips |
In the @use JSDoc specification, inline jsdoc tags other than Other than /**
* ### The JSDoc {@linkcode https://en.wikipedia.org/wiki/JSDoc JSDoc (Wiki)}
* * see {@link https://en.wikipedia.org/wiki/JSDoc JSDoc (Wiki) - @link}
* * see {@linkplain https://en.wikipedia.org/wiki/JSDoc JSDoc (Wiki) - @linkplain}
* * see {@linkcode https://en.wikipedia.org/wiki/JSDoc|JSDoc (Wiki) - @linkcode}
* * see {@tutorial https://en.wikipedia.org/wiki/JSDoc JSDoc (Wiki) - @tutorial}
* * [JSDoc (Wiki)](https://en.wikipedia.org/wiki/JSDoc)
* * JSDoc (Wiki) - https://en.wikipedia.org/wiki/JSDoc
* @param {string} a - postfix string, see {@link https://en.wikipedia.org/wiki/JSDoc JSDoc (Wiki) - @link}
* @see {@link https://en.wikipedia.org/wiki/JSDoc|JSDoc (Wiki)}
* @see String.fromCharCode
* @returns {ReturnType<typeof JSDoc>} this function return a `string`. see {@link https://en.wikipedia.org/wiki/JSDoc|JSDoc (Wiki)}
*/
const JSDoc = (a) => `JSDoc (${a})`; |
Please verify that:
Backlog
milestone (required)master
branchgulp runtests
locally/[^\*|\s|(/\*\*)]/
is obviously incorrect as a regex for the intent described in the line commentthanks