File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export class PythonHoverProvider implements vscode.HoverProvider {
1717 let capturedInfo : string [ ] = [ ] ;
1818 data . items . forEach ( item => {
1919 let { description, signature } = item ;
20+ const rawSignature = signature ;
2021 switch ( item . kind ) {
2122 case vscode . SymbolKind . Constructor :
2223 case vscode . SymbolKind . Function :
@@ -34,8 +35,13 @@ export class PythonHoverProvider implements vscode.HoverProvider {
3435 }
3536 if ( item . docstring ) {
3637 let lines = item . docstring . split ( EOL ) ;
37- if ( lines . length > 0 && lines [ 0 ] === item . signature ) {
38+ // If the docstring starts with the signature, then remove those lines from the docstring
39+ if ( lines . length > 0 && item . signature . indexOf ( lines [ 0 ] ) === 0 ) {
3840 lines . shift ( ) ;
41+ let endIndex = lines . findIndex ( line => item . signature . endsWith ( line ) ) ;
42+ if ( endIndex >= 0 ) {
43+ lines = lines . filter ( ( line , index ) => index > endIndex ) ;
44+ }
3945 }
4046 if ( lines . length > 0 && item . signature . startsWith ( currentWord ) && lines [ 0 ] . startsWith ( currentWord ) && lines [ 0 ] . endsWith ( ')' ) ) {
4147 lines . shift ( ) ;
You can’t perform that action at this time.
0 commit comments