def SignatureHelp_ArgTrigger_test( app ): RunTest( app, { 'description': 'Trigger after ,', 'request': { 'filetype' : 'java', 'filepath' : ProjectPath( 'SignatureHelp.java' ), 'line_num' : 5, 'column_num': 23, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 1, 'activeParameter': 1, 'signatures': contains_exactly( SignatureMatcher( 'test(int i, String s) : void', [ ParameterMatcher( 5, 10 ), ParameterMatcher( 12, 20 ) ] ), SignatureMatcher( 'test(String s, String s1) : void', [ ParameterMatcher( 5, 13 ), ParameterMatcher( 15, 24 ) ] ) ), } ), } ) } } )
def Signature_Help_Multiple_Signatures_test( app ): RunTest( app, { 'description': 'Test overloaded methods', 'request': { 'filetype' : 'typescript', 'filepath' : PathToTestFile( 'signatures.ts' ), 'line_num' : 89, 'column_num': 18, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 1, 'activeParameter': 1, 'signatures': contains( SignatureMatcher( 'øverløåd(a: number): string', [ ParameterMatcher( 12, 21 ) ] ), SignatureMatcher( 'øverløåd(a: string, b: number): string', [ ParameterMatcher( 12, 21 ), ParameterMatcher( 23, 32 ) ] ) ), } ), } ) } } )
def test_SignatureHelp_MultipleDefinitions_OneActive(self, app): RunTest( app, { 'description': 'Jedi returns multiple signatures - both active', 'request': { 'filetype': 'python', 'filepath': PathToTestFile('signature_help.py'), 'line_num': 30, 'column_num': 30, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 1, 'activeParameter': 3, 'signatures': contains_exactly( SignatureMatcher( 'def MultipleDefinitions( a, b, c )', [ ParameterMatcher(25, 26), ParameterMatcher(28, 29), ParameterMatcher(31, 32) ]), SignatureMatcher( 'def MultipleDefinitions( many,' ' more,' ' arguments,' ' to,' ' this,' ' one )', [ ParameterMatcher(25, 29), ParameterMatcher(31, 35), ParameterMatcher(37, 46), ParameterMatcher(48, 50), ParameterMatcher(52, 56), ParameterMatcher(58, 61) ])), }), }) } })
def test_Signature_Help_Trigger(self, app): RunTest( app, { 'description': 'trigger after (', 'request': { 'filetype': 'cpp', 'filepath': PathToTestFile('general_fallback', 'make_drink.cc'), 'line_num': 7, 'column_num': 14, 'signature_help_state': 'INACTIVE', }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher( 'make_drink(TypeOfDrink type, ' 'Temperature temp, ' 'int sugargs) -> Drink &', [ ParameterMatcher(11, 27), ParameterMatcher(29, 45), ParameterMatcher(47, 58), ]), SignatureMatcher( 'make_drink(TypeOfDrink type, ' 'double fizziness, ' 'Flavour Flavour) -> Drink &', [ ParameterMatcher(11, 27), ParameterMatcher(29, 45), ParameterMatcher(47, 62), ]), ) }), }) }, })
def test_Signature_Help_WithDoc( self, app ): RunTest( app, { 'description': 'Test parameter documentation', 'request': { 'filetype': 'typescript', 'filepath': PathToTestFile( 'signatures.ts' ), 'line_num': 101, 'column_num': 26, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher( 'single_argument_with_doc(a: string): string', [ ParameterMatcher( 25, 34, '- The argument' ) ], 'A function with a single argument' ) ) } ), } ) } } )
def Signature_Help_Trigger_Comma_test( app ): RunTest( app, { 'description': 'Trigger after ,', 'request': { 'filetype' : 'typescript', 'filepath' : PathToTestFile( 'signatures.ts' ), 'line_num' : 60, 'column_num': 32, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 1, 'signatures': contains( SignatureMatcher( ( 'multi_argument_no_return(løng_våriable_name: number, ' 'untyped_argument: any): number' ), [ ParameterMatcher( 25, 53 ), ParameterMatcher( 55, 76 ) ] ) ), } ), } ) } } )
def test_SignatureHelp_NoParams(self, app): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype': 'go', 'filepath': PathToTestFile('goto.go'), 'line_num': 8, 'column_num': 11, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly(SignatureMatcher('dummy()', [])), }), }) } })
def test_SignatureHelp_MethodTrigger(self, app): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype': 'go', 'filepath': PathToTestFile('td', 'signature_help.go'), 'line_num': 10, 'column_num': 18, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher('add(x int, y int) int', [ ParameterMatcher(4, 9), ParameterMatcher(11, 16) ])), }), }) } })
def Signature_Help_Trigger_Paren_test(app): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype': 'typescript', 'filepath': PathToTestFile('signatures.ts'), 'line_num': 27, 'column_num': 29, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains( SignatureMatcher( 'single_argument_with_return(a: string): string', [ParameterMatcher(28, 37)])), }), }) } })
def test_SignatureHelp_MethodTrigger(self, app): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype': 'java', 'filepath': ProjectPath('SignatureHelp.java'), 'line_num': 9, 'column_num': 17, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher('unique(double d) : void', [ParameterMatcher(7, 15)])), }), }) } })
def test_SignatureHelp_Constructor(self, app): RunTest( app, { 'description': 'Constructor', 'request': { 'filetype': 'java', 'filepath': ProjectPath('SignatureHelp.java'), 'line_num': 17, 'column_num': 41, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher( 'SignatureHelp(String signature)', [ParameterMatcher(14, 30)])), }), }) } })
def Signature_Help_Trigger_AngleBracket_test( app ): RunTest( app, { 'description': 'Trigger after <', 'request': { 'filetype' : 'typescript', 'filepath' : PathToTestFile( 'signatures.ts' ), 'line_num' : 68, 'column_num': 9, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains( SignatureMatcher( 'generic<TYPE extends ReturnValue>(t: SomeClass): string', [ ParameterMatcher( 8, 32 ) ] ) ), } ), } ) } } )
def SignatureHelp_MethodTrigger_test( app ): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype' : 'python', 'filepath' : PathToTestFile( 'general_fallback', 'lang_python.py' ), 'line_num' : 6, 'column_num': 10, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains( SignatureMatcher( 'def hack( obj )', [ ParameterMatcher( 10, 13 ) ] ) ), } ), } ) } } )
def SignatureHelp_CallWithinCall_test( app ): RunTest( app, { 'description': 'Trigger after , within a call-within-a-call', 'request': { 'filetype' : 'python', 'filepath' : PathToTestFile( 'signature_help.py' ), 'line_num' : 14, 'column_num': 43, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 1, 'signatures': contains( SignatureMatcher( 'def center( width: int, fillchar: str=... )', [ ParameterMatcher( 12, 22 ), ParameterMatcher( 24, 41 ) ] ) ), } ), } ) } } )
def test_SignatureHelp_TriggerComma(self, app): filepath = PathToTestFile('testy', 'ContinuousTest.cs') contents = ReadFile(filepath) request = BuildRequest(line_num=17, column_num=16, filetypes=['cs'], filepath=filepath, contents=contents) with WrapOmniSharpServer(app, filepath): response = app.post_json('/signature_help', request).json LOGGER.debug('response = %s', response) assert_that( response, has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 1, 'signatures': contains_exactly( SignatureMatcher( 'void ContinuousTest.MultiArg(int i, string s)', [ ParameterMatcher(29, 34), ParameterMatcher(36, 44) ])) }) }))
def SignatureHelp_Constructor_test(app): RunTest( app, { 'description': 'Trigger after , within a call-within-a-call', 'request': { 'filetype': 'python', 'filepath': PathToTestFile('signature_help.py'), 'line_num': 14, 'column_num': 61, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains( SignatureMatcher('class Class( argument )', [ParameterMatcher(13, 21)])), }), }) } })
def SignatureHelp_MultipleParameters_test( app ): RunTest( app, { 'description': 'Trigger after ,', 'request': { 'filetype' : 'python', 'filepath' : PathToTestFile( 'signature_help.py' ), 'line_num' : 14, 'column_num': 50, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 1, 'signatures': contains( SignatureMatcher( 'def MultipleArguments( a, b, c )', [ ParameterMatcher( 23, 24 ), ParameterMatcher( 26, 27 ), ParameterMatcher( 29, 30 ) ] ) ), } ), } ) } } )
def SignatureHelp_MethodTrigger_test(app): RunTest( app, { 'description': 'Trigger after (', 'request': { 'filetype': 'rust', 'filepath': PathToTestFile('common', 'src', 'test.rs'), 'line_num': 13, 'column_num': 20, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher('fn build_rocket(&self)', [])), }), }) } })
def SignatureHelp_TriggerParen_test(app): filepath = PathToTestFile('testy', 'ContinuousTest.cs') contents = ReadFile(filepath) request = BuildRequest(line_num=10, column_num=9, filetypes=['cs'], filepath=filepath, contents=contents) with WrapOmniSharpServer(app, filepath): response = app.post_json('/signature_help', request).json LOGGER.debug('response = %s', response) assert_that( response, has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains( SignatureMatcher( 'void ContinuousTest.Main(string[] args)', [ParameterMatcher(25, 38)])) }) }))
def Signature_Help_Trigger_After_Arguments_Narrow2_test( app ): RunTest( app, { 'description': 'After resolution of overload not the first one', 'request': { 'filetype' : 'cpp', 'filepath' : PathToTestFile( 'general_fallback', 'make_drink.cc' ), 'line_num' : 8, 'column_num': 53, 'signature_help_state': 'ACTIVE', }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 2, 'signatures': contains_exactly( SignatureMatcher( 'make_drink(TypeOfDrink type, ' 'Temperature temp, ' 'int sugargs) -> Drink &', [ ParameterMatcher( 11, 27 ), ParameterMatcher( 29, 45 ), ParameterMatcher( 47, 58 ), ] ) ) } ), } ), }, } )
def SignatureHelp_MultipleSignatures_test( app ): filepath = PathToTestFile( 'testy', 'ContinuousTest.cs' ) contents = ReadFile( filepath ) request = BuildRequest( line_num = 18, column_num = 15, filetypes = [ 'cs' ], filepath = filepath, contents = contents ) with WrapOmniSharpServer( app, filepath ): response = app.post_json( '/signature_help', request ).json LOGGER.debug( 'response = %s', response ) assert_that( response, has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 0, 'signatures': contains_exactly( SignatureMatcher( 'void ContinuousTest.Overloaded(int i, int a)', [ ParameterMatcher( 31, 36 ), ParameterMatcher( 38, 43 ) ] ), SignatureMatcher( 'void ContinuousTest.Overloaded(string s)', [ ParameterMatcher( 31, 39 ) ] ), ) } ) } ) ) request[ 'column_num' ] = 20 with WrapOmniSharpServer( app, filepath ): response = app.post_json( '/signature_help', request ).json LOGGER.debug( 'response = %s', response ) assert_that( response, has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 1, 'signatures': contains_exactly( SignatureMatcher( 'void ContinuousTest.Overloaded(int i, int a)', [ ParameterMatcher( 31, 36 ), ParameterMatcher( 38, 43 ) ] ), SignatureMatcher( 'void ContinuousTest.Overloaded(string s)', [ ParameterMatcher( 31, 39 ) ] ), ) } ) } ) )
def Signature_Help_Trigger_After_Arguments_Narrow_test(app): RunTest( app, { 'description': 'After resolution of overload', 'request': { 'filetype': 'cpp', 'filepath': PathToTestFile('general_fallback', 'make_drink.cc'), 'line_num': 7, 'column_num': 41, 'signature_help_state': 'ACTIVE', }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'errors': empty(), 'signature_help': has_entries({ 'activeSignature': 0, 'activeParameter': 2, 'signatures': contains( SignatureMatcher( 'make_drink(TypeOfDrink type, ' 'double fizziness, ' 'Flavour Flavour) -> Drink &', [ ParameterMatcher(11, 27), ParameterMatcher(29, 45), ParameterMatcher(47, 62), ])) }), }), }, })