-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type info is not working correctly #26
Comments
Ah this is my bad.. I thought stack ide already considered the selection when returning results but seeing this it obviously doesn't. I'll restore the old logic shortly! |
Should be fixed, @rvion can you let me know otherwise? Thanks! |
Wow, fast, thank you ! |
it doesn't seem to be working |
the function filter_enclosing doens't seem to do the same thing as your modification def filter_enclosing(_,from_col, to_col, from_line, to_line, spans):
return [span for span in spans if
( ((span[1].get("spanFromLine")<from_line) or
(span[1].get("spanFromLine") == from_line and
span[1].get("spanFromColumn") <= from_col))
and ((span[1].get("spanToLine")>to_line) or
(span[1].get("spanToLine") == to_line and
span[1].get("spanToColumn") >= to_col))
)] |
ping @tomv564 |
Can you make sure your Sublime is running the latest code? The filter_enclosing function should work the same, but could also use some tests (and it wouldn't be the first time I misunderstood it!). Instead of comparing line and column together it translates everything to Region objects and compares those. |
Yes, I'm running the latest code: $ git log --pretty=oneline --abbrev-commit -5
10d0a28 Merge pull request #33 from tomv564/fix_reset_stackide
9c43b83 remove settings from reset call, fix restart command
f531149 Correct other-modules and offer config example
2630a43 Merge pull request #27 from tomv564/fix_selection_type_info
3f479aa fix show selection type functionality but there is still a problem for me: my guess is that we have a different version of either |
found the bug :)/cc @tomv564 I have the automatic popup feature enabled: And when I hover some code, the automatic type popup is wrong: But when I hit Cmd+T (as you did to test the feature), it is correct this is because in https://github.com/lukexi/stack-ide-sublime/blob/master/win.py#L43-L50, there is a duplicated code branch that is wrong: types = list(parse_exp_types(exp_types))
if types:
# Display the first type in a region and in the status bar
view = self.window.active_view()
(type, span) = types[0]
if span:
if Win.show_popup:
view.show_popup(type) |
possible fix (but keeping two different code path) would be to change win.py from utility import ..., filter_enclosing
[...]
def highlight_type(self, exp_types):
"""
ide-backend gives us a wealth of type info for the cursor. We only use the first,
most specific one for now, but it gives us the types all the way out to the topmost
expression.
"""
type_spans = list(parse_exp_types(exp_types))
if type_spans:
_view = self.window.active_view()
_type = next(filter_enclosing(_view, _view.sel()[0], type_spans), None)
if not _type is None:
_view.set_status("type_at_cursor", _type)
if Win.show_popup:
_view.show_popup(_type) I'm not making the PR because above code still duplicates code already in ShowHsTypeAtCursorCommand |
Ah good find! If I have time I can leave some hints about a fix later. I'm also on OS-X with similar installed software / packages so the problem was definitely with the code :) |
I think the suggested change looks good, if you don't have a chance to fix it then I can do up a PR later! |
I made a PR (#7) that picked the right type info to show, but the feature doesn't seem to work anymore
Now
Before
Exemple 1 :
Example 2:
related code was:
The text was updated successfully, but these errors were encountered: