@@ -87,16 +87,29 @@ export const hoverProvider = languages.registerHoverProvider({ language: `sql` }
87
87
88
88
if ( result ) {
89
89
if ( 'routine' in result ) {
90
- const routineOffset = ref . tokens [ ref . tokens . length - 1 ] . range . end - 1 ;
91
- const callableRef = statementAt . getCallableDetail ( routineOffset , false ) ;
92
- if ( callableRef ) {
93
- const { currentCount } = getPositionData ( callableRef , routineOffset ) ;
94
- const signatures = await DbCache . getCachedSignatures ( callableRef . parentRef . object . schema , callableRef . parentRef . object . name ) ;
95
- const possibleSignatures = signatures . filter ( ( s ) => s . parms . length >= currentCount ) . sort ( ( a , b ) => a . parms . length - b . parms . length ) ;
96
- const signature = possibleSignatures . find ( ( signature ) => currentCount <= signature . parms . length ) ;
97
- if ( signature ) {
98
- addRoutineMd ( md , signature , result ) ;
99
- }
90
+ let signatures : CallableSignature [ ] ;
91
+ let signature : CallableSignature | undefined ;
92
+
93
+ const lastToken = ref . tokens [ ref . tokens . length - 1 ] ;
94
+
95
+ if ( lastToken . type === `closebracket` ) {
96
+ let routineOffset : number = lastToken . range . start - 1 ;
97
+ const callableRef = statementAt . getCallableDetail ( routineOffset , false ) ;
98
+ if ( callableRef ) {
99
+ const { currentCount } = getPositionData ( callableRef , routineOffset ) ;
100
+ signatures = await DbCache . getCachedSignatures ( callableRef . parentRef . object . schema , callableRef . parentRef . object . name ) ;
101
+ const possibleSignatures = signatures . filter ( ( s ) => s . parms . length >= currentCount ) . sort ( ( a , b ) => a . parms . length - b . parms . length ) ;
102
+ signature = possibleSignatures . find ( ( signature ) => currentCount <= signature . parms . length ) ;
103
+ }
104
+ }
105
+
106
+ if ( ! signature ) {
107
+ signatures = await DbCache . getCachedSignatures ( result . routine . schema , result . routine . name ) ;
108
+ signature = signatures [ 0 ] ;
109
+ }
110
+
111
+ if ( signature ) {
112
+ addRoutineMd ( md , signature , result ) ;
100
113
}
101
114
} else {
102
115
addSymbol ( md , result ) ;
0 commit comments