Trace API: give indicator of response success status#3010
Trace API: give indicator of response success status#3010testforstephen merged 1 commit intoredhat-developer:masterfrom
Conversation
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
|
|
||
| private getResultLength(value: any): number | undefined { | ||
| if (!value) { | ||
| return 0; |
There was a problem hiding this comment.
should we return undefined here?
There was a problem hiding this comment.
If the response is undefined, it indicates that there are no results and returning 0 is acceptable. For me, returning undefined means that we have not yet determined whether the response contains valid results.
There was a problem hiding this comment.
Ok, it makes sense. Then we probably need to revisit line 106. If value = { someKey: "some value" }, it now returns undefined, is that expected?
If 0 is expected in above case, shall we append ?? 0 like below?
return value?.length ?? value?.items?.length ?? 0;There was a problem hiding this comment.
Then we probably need to revisit line 106. If value = { someKey: "some value" }, it now returns undefined, is that expected?
Yes. We can return undefined for now. Maybe one day there will be a requirement to resolve some response values more accurately and we can improve it then.
…r#3010) Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
One use case for this API is to trace completion performance.
To support the feature Auto complete after new keyword #2010 ("new |"), we enabled completion trigger characters on whitespace. However, this also triggers many completion requests when typing whitespace for indentation. These requests are invalid and jdtls returns an empty array. We need a way to distinguish such noise data during tracing.