mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-27 22:39:59 -05:00
Integrated pull request feedback
This commit is contained in:
@@ -428,7 +428,35 @@ module ts.server {
|
||||
}
|
||||
|
||||
getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.SignatureHelpRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.SignatureHelpRequest>(CommandNames.SignatureHelp, args);
|
||||
var response = this.processResponse<protocol.SignatureHelpResponse>(request);
|
||||
|
||||
if (!response.body) {
|
||||
return undefined;
|
||||
}
|
||||
var helpItems: protocol.SignatureHelpItems = response.body;
|
||||
var span = helpItems.applicableSpan;
|
||||
var start = this.lineOffsetToPosition(fileName, span.start);
|
||||
var end = this.lineOffsetToPosition(fileName, span.end);
|
||||
|
||||
var result: SignatureHelpItems = {
|
||||
items: helpItems.items,
|
||||
applicableSpan: {
|
||||
start: start,
|
||||
length: end - start
|
||||
},
|
||||
selectedItemIndex: helpItems.selectedItemIndex,
|
||||
argumentIndex: helpItems.argumentIndex,
|
||||
argumentCount: helpItems.argumentCount,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
|
||||
10
src/server/protocol.d.ts
vendored
10
src/server/protocol.d.ts
vendored
@@ -644,7 +644,7 @@ declare module ts.server.protocol {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
|
||||
/**
|
||||
* The signatiure helps items for the parameters.
|
||||
* The signature helps items for the parameters.
|
||||
*/
|
||||
parameters: SignatureHelpParameter[];
|
||||
|
||||
@@ -655,17 +655,17 @@ declare module ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Signation help items found in the response of a signature help request.
|
||||
* Signature help items found in the response of a signature help request.
|
||||
*/
|
||||
export interface SignatureHelpItems {
|
||||
|
||||
/**
|
||||
* The signaure help items.
|
||||
* The signature help items.
|
||||
*/
|
||||
items: SignatureHelpItem[];
|
||||
|
||||
/**
|
||||
* @steveluc
|
||||
* The span for which signature help should appear on a signature
|
||||
*/
|
||||
applicableSpan: TextSpan;
|
||||
|
||||
@@ -680,7 +680,7 @@ declare module ts.server.protocol {
|
||||
argumentIndex: number;
|
||||
|
||||
/**
|
||||
* The argument counts
|
||||
* The argument count
|
||||
*/
|
||||
argumentCount: number;
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
var span = helpItems.applicableSpan;
|
||||
var result:protocol.SignatureHelpItems = {
|
||||
var result: protocol.SignatureHelpItems = {
|
||||
items: helpItems.items,
|
||||
applicableSpan: {
|
||||
start: compilerService.host.positionToLineOffset(file, span.start),
|
||||
|
||||
16
tests/cases/fourslash/server/signatureHelp.ts
Normal file
16
tests/cases/fourslash/server/signatureHelp.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////function foo(data: number) {
|
||||
////}
|
||||
////
|
||||
////function bar {
|
||||
//// foo(/*1*/)
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
verify.signatureHelpPresent();
|
||||
verify.signatureHelpCountIs(1);
|
||||
verify.signatureHelpArgumentCountIs(0);
|
||||
|
||||
verify.currentSignatureParameterCountIs(1);
|
||||
verify.currentSignatureHelpDocCommentIs('');
|
||||
Reference in New Issue
Block a user