Skip to content
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

refactored duplicate offset functions #762

Merged
merged 3 commits into from
Mar 16, 2016
Merged

refactored duplicate offset functions #762

merged 3 commits into from
Mar 16, 2016

Conversation

nhooyr
Copy link
Contributor

@nhooyr nhooyr commented Mar 16, 2016

Closes #719

function! go#complete#GetInfo()
let offset = go#complete#gocodeCursor()+1
return go#complete#GetInfoFromOffset(offset)
endfunction
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a public function that people use, for example to plugin into statusline or use for their own functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is still there, I renamed the top one.

@fatih
Copy link
Owner

fatih commented Mar 16, 2016

Hi @nhooyr, did you also checked out which implementation is the correct one? Or are they really all the same?


let argOff = "-o=" . offs
return argOff
return "-o=" . go#util#OffsetCursor()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove s:getOffset() and change def.vim to make it that it uses this directly if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

@nhooyr
Copy link
Contributor Author

nhooyr commented Mar 16, 2016

@fatih all are the basically the exact same as far as I can tell.

@nhooyr
Copy link
Contributor Author

nhooyr commented Mar 16, 2016

updated based on feedback.

@fatih
Copy link
Owner

fatih commented Mar 16, 2016

Thanks @nhooyr I need to test this myself, If everything works as intended, I'll merge it.

@nhooyr
Copy link
Contributor Author

nhooyr commented Mar 16, 2016

@fatih ok. here are the differences, the ones in rename.vim and oracle.vim were the exact same. They were copies of the go#complete#gocodeCursor without the special case newline line and instead took the length/column as arguments. The last one in def.vim is the exact same as well but instead of using line() or col() it uses getpos() and it uses go#util#LineEnding().

fatih added a commit that referenced this pull request Mar 16, 2016
refactored duplicate offset functions
@fatih fatih merged commit 8e1b75d into fatih:master Mar 16, 2016
@fatih
Copy link
Owner

fatih commented Mar 16, 2016

Thanks @nhooyr , great refactor, much appreciated 👍

@nhooyr nhooyr deleted the refactor-offset-functions branch March 16, 2016 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants