-
Notifications
You must be signed in to change notification settings - Fork 14
Backport commits from ruby/ruby #189
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give some context for why this change was made? Is it a performance issue or something else?
I’m good with the PR overall but want to preserve some context so if someone refactors this later they will understand the intent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not performance reason.
-rsyntax_suggestdidn't work withmake test-syntax-suggeston ruby/ruby repository. It raisesuninitialized constant SyntaxSuggest::VERSION (NameError). I'm not sure why they are different result.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe because the lib by default doesn't require
versionfile: https://github.com/ruby/syntax_suggest/blob/b57fe7f/lib/syntax_suggest.rbI think it's OK practice. We can do in this way, or left it here and just add
require_relative 'syntax_suggest/version'in the main lib file.Nothing of this is performance-related, I think.
Also you can think in this way: if you want to inspect a library, or even a project with this library, where it's required, and you faced some issues, and want to check its version —
SyntaxSuggest::VERSIONtheoretically exist, but there (inirborpry) also will be the exception without additionalrequire 'syntax_suggest/version'.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think originally I did that as a kind of guard for if the code was loaded or not. But I’m using this now
syntax_suggest/lib/syntax_suggest/core_ext.rb
Line 25 in b57fe7f
so if we want to load the version always I think it’s no problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use something like autoload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to load the version file instead of autoload.
I remember hitting some edgecase-y things with autoload when working on this. Unfortunately I didn’t write down exactly what those problems were.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think simple
require_relativewith singleVERSIONconstant would not make a big impact on performance.