microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
912 stars 131 forks source link

Issues with hover text with pandas.read_csv #982

Open gramster opened 5 years ago

gramster commented 5 years ago

With 0.2.56 LS:

Hovering on pd.read_csv shows:

parser_f(filepath_or_buffer, sep=sep, delimiter=None, header='infer', names=None, index_col=None, usecols=None, squeeze=False, prefix=None, mangle_dupe_cols=True, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skipinitialspace=False, skiprows=None, skipfooter=0, nrows=None, na_values=None, keep_default_na=True, na_filter=True, verbose=False, skip_blank_lines=True, parse_dates=False, infer_datetime_format=False, keep_date_col=False, date_parser=None, dayfirst=False, iterator=False, chunksize=None, compression='infer', thousands=None, decimal=b'.', lineterminator=None, quotechar='"', quoting=csv.QUOTE_MINIMAL, doublequote=True, escapechar=None, comment=None, encoding=None, dialect=None, tupleize_cols=None, error_bad_lines=True, warn_bad_lines=True, delim_whitespace=False, low_memory=_c_parser_defaults['low_memory'], memory_map=False, float_precision=None)

It should show read_csv, not parser_f. Also, there's no documentation shown.

jakebailey commented 5 years ago

This is because read_csv (and its related functions) are created dynamically, see:

https://github.com/pandas-dev/pandas/blob/80d150ab9dd99984e5734a69a54738a1c7859ffb/pandas/io/parsers.py

parser_f is the actual function behind read_csv; showing that in the tooltip is a visual thing we can fix up.

The documentation is created at runtime and set on the function; we don't have access to it at the AST level (where we get the docstring or comments).

jakebailey commented 5 years ago

Still doesn't show read_csv at the moment:

image

Also had a time when testing where it had no hover, and F12ing it only went to the module it was exported from (not to the definition).