Conversation
sandersn
left a comment
There was a problem hiding this comment.
The refactor looks solid although perhaps somebody else who is familiar with the server code should also review.
src/server/editorServices.ts
Outdated
| info(`Project '${project.getProjectName()}' (${ProjectKind[project.projectKind]}) ${counter}`); | ||
| info(project.filesToString()); | ||
| info("-----------------------------------------------"); | ||
| counter++; |
There was a problem hiding this comment.
Can you remove the count updating responsibility from printProjects and replace it with const counter = this.externalProjects.length + this.configuredProjects.length + this.inferredProjects.length. Then printProjects can be lifted out of this function entirely.
There was a problem hiding this comment.
@sandersn, counter is used on line 948, though its still feasible to do something like:
function printProjects(projects: Project[], counter: number) {
for (const project of projects) {
...
counter++;
}
return counter;
}And then use it like this:
let counter = 0;
counter = printProjects(this.externalProjects, counter);
counter = printProjects(this.configuredProjects, counter);
printProjects(this.inferredProjects, counter);
src/server/editorServices.ts
Outdated
| info(`Project '${project.getProjectName()}' (${ProjectKind[project.projectKind]}) ${counter}`); | ||
| info(project.filesToString()); | ||
| info("-----------------------------------------------"); | ||
| counter++; |
There was a problem hiding this comment.
@sandersn, counter is used on line 948, though its still feasible to do something like:
function printProjects(projects: Project[], counter: number) {
for (const project of projects) {
...
counter++;
}
return counter;
}And then use it like this:
let counter = 0;
counter = printProjects(this.externalProjects, counter);
counter = printProjects(this.configuredProjects, counter);
printProjects(this.inferredProjects, counter);| } | ||
|
|
||
| perftrc(s: string) { | ||
| this.msg(s, Msg.Perf); |
There was a problem hiding this comment.
Could we instead turn Msg into a string enum? That would allow us to continue to find all references if necessary.
| getLogFileName(): string; | ||
| } | ||
|
|
||
| export namespace Msg { |
There was a problem hiding this comment.
Why not turn this into a string enum?
There was a problem hiding this comment.
There should only be one reference to each kind of message -- one each in perftrc(), info(), and err().
|
Odd. It looks like Travis caught an error due to an invalid cast, but Jenkins didn't. |
|
I think the validity of the cast recently changed, so it might have to do with the TypeScript versions they're using. |
|
Yeah, I just saw it locally after merging from master. |
|
Fix is already in. #17685 |
Just have
groupinstead of separatestartGroupandendGroup.Consolidate all noop test loggers.
Don't expose
msg.