Compare commits

...

4 commits

Author SHA1 Message Date
csigs 445274e24b LEGO: check in for master to temporary branch. 2020-09-02 06:11:07 +00:00
Andrew Branch 3b502f4ec1
Fix call hierarchy item serialization and server tests (#40348) 2020-09-01 15:21:03 -07:00
Erich Gamma 8cac241f9e Revert "fix anders"
This reverts commit b3178d4618.
2020-09-01 20:51:34 +02:00
Erich Gamma b3178d4618 fix anders 2020-09-01 20:39:27 +02:00
7 changed files with 263 additions and 29 deletions

View file

@ -757,6 +757,7 @@ namespace ts.server {
name: item.name,
kind: item.kind,
kindModifiers: item.kindModifiers,
containerName: item.containerName,
span: this.decodeSpan(item.span, item.file),
selectionSpan: this.decodeSpan(item.selectionSpan, item.file)
};
@ -778,7 +779,7 @@ namespace ts.server {
provideCallHierarchyIncomingCalls(fileName: string, position: number) {
const args = this.createFileLocationRequestArgs(fileName, position);
const request = this.processRequest<protocol.ProvideCallHierarchyIncomingCallsRequest>(CommandNames.PrepareCallHierarchy, args);
const request = this.processRequest<protocol.ProvideCallHierarchyIncomingCallsRequest>(CommandNames.ProvideCallHierarchyIncomingCalls, args);
const response = this.processResponse<protocol.ProvideCallHierarchyIncomingCallsResponse>(request);
return response.body.map(item => this.convertCallHierarchyIncomingCall(item));
}
@ -792,7 +793,7 @@ namespace ts.server {
provideCallHierarchyOutgoingCalls(fileName: string, position: number) {
const args = this.createFileLocationRequestArgs(fileName, position);
const request = this.processRequest<protocol.ProvideCallHierarchyOutgoingCallsRequest>(CommandNames.PrepareCallHierarchy, args);
const request = this.processRequest<protocol.ProvideCallHierarchyOutgoingCallsRequest>(CommandNames.ProvideCallHierarchyOutgoingCalls, args);
const response = this.processResponse<protocol.ProvideCallHierarchyOutgoingCallsResponse>(request);
return response.body.map(item => this.convertCallHierarchyOutgoingCall(fileName, item));
}

View file

@ -6936,15 +6936,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Modul {0} nemá žádný exportovaný člen {1}. Neměli jste na mysli {2}?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?]]></Val>
@ -12573,6 +12564,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_has_no_exported_member_named_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' has no exported member named '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{0} nemá žádný exportovaný člen s názvem {1}. Neměli jste na mysli {2}?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage.]]></Val>
@ -12681,6 +12681,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[{0} se nepovoluje jako název deklarace proměnné.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is referenced directly or indirectly in its own base expression.]]></Val>

View file

@ -6939,15 +6939,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le module '{0}' n'a aucun membre exporté '{1}'. Pensiez-vous plutôt à '{2}' ?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?]]></Val>
@ -12576,6 +12567,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_has_no_exported_member_named_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' has no exported member named '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' n'a aucun membre exporté nommé '{1}'. Est-ce que vous pensiez à '{2}' ?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage.]]></Val>
@ -12684,6 +12684,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' n'est pas autorisé en tant que nom de déclaration de variable.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is referenced directly or indirectly in its own base expression.]]></Val>

View file

@ -6927,15 +6927,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Per il modulo '{0}' non esiste alcun membro esportato '{1}'. Si intendeva '{2}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead_2614" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?]]></Val>
@ -12564,6 +12555,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_has_no_exported_member_named_1_Did_you_mean_2_2724" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' has no exported member named '{1}'. Did you mean '{2}'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[In '{0}' non è presente alcun membro esportato denominato '{1}'. Si intendeva '{2}'?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage.]]></Val>
@ -12672,6 +12672,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_not_allowed_as_a_variable_declaration_name_1389" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is not allowed as a variable declaration name.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' non è consentito come nome di una dichiarazione di variabile.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA['{0}' is referenced directly or indirectly in its own base expression.]]></Val>

View file

@ -2408,6 +2408,7 @@ namespace ts.server {
kind: item.kind,
kindModifiers: item.kindModifiers,
file: item.file,
containerName: item.containerName,
span: toProtocolTextSpan(item.span, scriptInfo),
selectionSpan: toProtocolTextSpan(item.selectionSpan, scriptInfo)
};

View file

@ -0,0 +1,165 @@
╭ name: f
├ kind: function
├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
├ span:
│ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:1:1-1:16
│ │ 1: function f() {}
│ │ ^^^^^^^^^^^^^^^
│ ╰
├ selectionSpan:
│ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:1:10-1:11
│ │ 1: function f() {}
│ │ ^
│ ╰
├ incoming:
│ ╭ from:
│ │ ╭ name: sameName
│ │ ├ kind: method
│ │ ├ containerName: A
│ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ ├ span:
│ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:4:3-6:4
│ │ │ │ 4: static sameName() {
│ │ │ │ ^^^^^^^^^^^^^^^^^^^
│ │ │ │ 5: f();
│ │ │ │ ^^^^^^^^
│ │ │ │ 6: }
│ │ │ │ ^^^
│ │ │ ╰
│ │ ├ selectionSpan:
│ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:4:10-4:18
│ │ │ │ 4: static sameName() {
│ │ │ │ ^^^^^^^^
│ │ │ ╰
│ │ ├ incoming:
│ │ │ ╭ from:
│ │ │ │ ╭ name: sameName
│ │ │ │ ├ kind: method
│ │ │ │ ├ containerName: B
│ │ │ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ │ │ ├ span:
│ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:10:3-12:4
│ │ │ │ │ │ 10: sameName() {
│ │ │ │ │ │ ^^^^^^^^^^^^
│ │ │ │ │ │ 11: A.sameName();
│ │ │ │ │ │ ^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ 12: }
│ │ │ │ │ │ ^^^
│ │ │ │ │ ╰
│ │ │ │ ├ selectionSpan:
│ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:10:3-10:11
│ │ │ │ │ │ 10: sameName() {
│ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ ╰
│ │ │ │ ├ incoming:
│ │ │ │ │ ╭ from:
│ │ │ │ │ │ ╭ name: sameName
│ │ │ │ │ │ ├ kind: getter
│ │ │ │ │ │ ├ containerName: Obj
│ │ │ │ │ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ │ │ │ │ ├ span:
│ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:16:3-18:4
│ │ │ │ │ │ │ │ 16: get sameName() {
│ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ 17: return new B().sameName;
│ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ 18: }
│ │ │ │ │ │ │ │ ^^^
│ │ │ │ │ │ │ ╰
│ │ │ │ │ │ ├ selectionSpan:
│ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:16:7-16:15
│ │ │ │ │ │ │ │ 16: get sameName() {
│ │ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ │ │ ╰
│ │ │ │ │ │ ├ incoming:
│ │ │ │ │ │ │ ╭ from:
│ │ │ │ │ │ │ │ ╭ name: sameName
│ │ │ │ │ │ │ │ ├ kind: function
│ │ │ │ │ │ │ │ ├ containerName: Foo
│ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ │ │ │ │ │ │ ├ span:
│ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:22:3-24:4
│ │ │ │ │ │ │ │ │ │ 22: function sameName() {
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ 23: return Obj.sameName;
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ 24: }
│ │ │ │ │ │ │ │ │ │ ^^^
│ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ ├ selectionSpan:
│ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:22:12-22:20
│ │ │ │ │ │ │ │ │ │ 22: function sameName() {
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ ├ incoming:
│ │ │ │ │ │ │ │ │ ╭ from:
│ │ │ │ │ │ │ │ │ │ ╭ name: C
│ │ │ │ │ │ │ │ │ │ ├ kind: class
│ │ │ │ │ │ │ │ │ │ ├ containerName: Foo
│ │ │ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ │ │ │ │ │ │ │ │ ├ span:
│ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:26:3-30:4
│ │ │ │ │ │ │ │ │ │ │ │ 26: export class C {
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ 27: constructor() {
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ 28: sameName();
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ 29: }
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ 30: }
│ │ │ │ │ │ │ │ │ │ │ │ ^^^
│ │ │ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ │ │ ├ selectionSpan:
│ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:26:16-26:17
│ │ │ │ │ │ │ │ │ │ │ │ 26: export class C {
│ │ │ │ │ │ │ │ │ │ │ │ ^
│ │ │ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ │ │ ├ incoming:
│ │ │ │ │ │ │ │ │ │ │ ╭ from:
│ │ │ │ │ │ │ │ │ │ │ │ ╭ name: sameName
│ │ │ │ │ │ │ │ │ │ │ │ ├ kind: function
│ │ │ │ │ │ │ │ │ │ │ │ ├ containerName: Bar
│ │ │ │ │ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts
│ │ │ │ │ │ │ │ │ │ │ │ ├ span:
│ │ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:34:20-34:37
│ │ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C();
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ │ │ │ │ ├ selectionSpan:
│ │ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:34:9-34:17
│ │ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C();
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ │ │ │ │ │ │ │ │ ╰
│ │ │ │ │ │ │ │ │ │ │ │ ╰ incoming: none
│ │ │ │ │ │ │ │ │ │ │ ├ fromSpans:
│ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:34:34-34:35
│ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C();
│ │ │ │ │ │ │ │ │ │ │ │ │ ^
│ │ │ │ │ │ │ │ │ │ ╰ ╰ ╰
│ │ │ │ │ │ │ │ │ ├ fromSpans:
│ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:28:7-28:15
│ │ │ │ │ │ │ │ │ │ │ 28: sameName();
│ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ │ │ │ ╰ ╰ ╰
│ │ │ │ │ │ │ ├ fromSpans:
│ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:23:16-23:24
│ │ │ │ │ │ │ │ │ 23: return Obj.sameName;
│ │ │ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ │ │ ╰ ╰ ╰
│ │ │ │ │ ├ fromSpans:
│ │ │ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:17:20-17:28
│ │ │ │ │ │ │ 17: return new B().sameName;
│ │ │ │ │ │ │ ^^^^^^^^
│ │ │ │ ╰ ╰ ╰
│ │ │ ├ fromSpans:
│ │ │ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:11:7-11:15
│ │ │ │ │ 11: A.sameName();
│ │ │ │ │ ^^^^^^^^
│ │ ╰ ╰ ╰
│ ├ fromSpans:
│ │ ╭ /tests/cases/fourslash/server/callHierarchyContainerNameServer.ts:5:5-5:6
│ │ │ 5: f();
│ │ │ ^
│ ╰ ╰
╰ outgoing: none

View file

@ -0,0 +1,40 @@
/// <reference path="../fourslash.ts" />
////function /**/f() {}
////
////class A {
//// static sameName() {
//// f();
//// }
////}
////
////class B {
//// sameName() {
//// A.sameName();
//// }
////}
////
////const Obj = {
//// get sameName() {
//// return new B().sameName;
//// }
////};
////
////namespace Foo {
//// function sameName() {
//// return Obj.sameName;
//// }
////
//// export class C {
//// constructor() {
//// sameName();
//// }
//// }
////}
////
////module Foo.Bar {
//// const sameName = () => new Foo.C();
////}
goTo.marker();
verify.baselineCallHierarchy();