-
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
Allow plugins to provide a list of external files. #15308
Conversation
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.
My super annoying lint nits
src/server/project.ts
Outdated
// by the LSHost for files in the program when the program is retrieved above but | ||
// the program doesn't contain external files so this must be done explicitly. | ||
inserted => { | ||
const scriptInfo = this.projectService.getOrCreateScriptInfo(inserted, false); |
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.
15:47:16 src/server/project.ts
15:47:16 ERROR: 579:92 boolean-trivia Tag boolean argument with parameter name
src/server/utilities.ts
Outdated
const bItem = b[bIndex]; | ||
const compareResult = compare(aItem, bItem); | ||
if (compareResult < 0) { | ||
inserted(aItem) |
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.
15:47:16 src/server/utilities.ts
15:47:16 ERROR: 204:32 semicolon Missing semicolon
src/server/utilities.ts
Outdated
export function enumerateInsertsAndDeletes<T>(a: SortedReadonlyArray<T>, b: SortedReadonlyArray<T>, inserted: (item: T) => void, deleted: (item: T) => void, compare?: (a: T, b: T) => number) { | ||
if (!compare) compare = (a, b) => a > b ? 1 : a < b ? -1 : 0; | ||
let aIndex = 0, aLen = a.length; | ||
let bIndex = 0, bLen = b.length; |
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.
15:47:16 src/server/utilities.ts
15:47:16 ERROR: 197:25 prefer-const Identifier 'aLen' is never reassigned; use 'const' instead of 'let'.
15:47:16 ERROR: 198:25 prefer-const Identifier 'bLen' is never reassigned; use 'const' instead of 'let'.
src/server/utilities.ts
Outdated
@@ -192,6 +192,33 @@ namespace ts.server { | |||
return <any>arr; | |||
} | |||
|
|||
export function enumerateInsertsAndDeletes<T>(a: SortedReadonlyArray<T>, b: SortedReadonlyArray<T>, inserted: (item: T) => void, deleted: (item: T) => void, compare?: (a: T, b: T) => number) { | |||
if (!compare) compare = (a, b) => a > b ? 1 : a < b ? -1 : 0; |
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.
Curlies, also consider
compare = compare || ts.compareValues
if its semantics work well enough on undefined
values.
src/server/project.ts
Outdated
}, | ||
removed => { | ||
const scriptInfoToDetach = this.projectService.getScriptInfo(removed); | ||
if (scriptInfoToDetach) |
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.
curlies
src/server/project.ts
Outdated
getExternalFiles(): string[] { | ||
return []; | ||
getExternalFiles(): SortedReadonlyArray<string> { | ||
return [] as any as SortedReadonlyArray<string>; |
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.
Could you not just use emptyArray
?
src/server/utilities.ts
Outdated
if (compareResult < 0) { | ||
inserted(aItem) | ||
aIndex++; | ||
} else if (compareResult > 0) { |
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.
else
s on next line
Looks like some lint failures (run |
@RyanCavanaugh For some reason I cannot get |
@chuckjaz I'm not aware of any problems. What's the console output? |
@RyanCavanaugh I found out what it is. I had a very old |
The list of the plugin's external files and request made to a file in the list will be routed to an instance of the plugin.
dd2755a
to
785c281
Compare
Any update on this? |
@RyanCavanaugh can you please review this change |
LGTM |
@mhegazy please merge once you've given a quick sanity check as well |
The list of the plugin's external files and request made to
a file in the list will be routed to an instance of the plugin.