Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Add links in exception page to open Application Trace file to line in VSCode. Now only support VSCode or VSCodium.
Add following to your Rails Gemfile
:
group :development do
gem 'open_code-rails'
end
VSCode supports Opening VS Code with URLs.
This gem simply inject some CSS and JS to HTML response while status is 500. Your browser will parse DOM and generate new links.
You should put settings in config/environments/development.rb
because this gem should only work in dev server. It will prevent production server starting up.
config.open_code.editor
- default: 'vscode'
Currently only support 'vscode'
and 'vscodium'
. It will be used to link's scheme part, like vscode://
or vscodium://
. You can set it any string but probably won't work, unless your editor supports <scheme>://file/<absolute file path>
.
Set to false
, 'off'
or 'disabled'
to disable this gem
# config/environments/development.rb
Rails.application.configure do
config.open_code.editor = 'vscodium'
end
config.open_code.place_holder
- default: ''
(blank)
Leave it blank will display links as VSCode icon. If you set it to a string, it will display text rather than icon. In case your browser does not support SVG Data URI in CSS, or you don't like the icon.
# config/environments/development.rb
Rails.application.configure do
config.open_code.place_holder = 'Open in VSCodium'
end
config.open_code.root_dir
- default: ::Rails.root
The absolute path of your Rails project folder. Sometimes you may run dev server remotely, so you need to set it to your local path.
# config/environments/development.rb
Rails.application.configure do
config.open_code.editor = '/Users/MyName/projects'
end
config.open_code.logger_url
- default: false
Display VSCode/VSCodium urls rather than relative filenames in Rails Logger. So you should see URLs in dev mode console and development.log
.
This option directly replaces the results of
::Rails.backtrace_cleaner.clean
.
Some flexibility is probably required for cooperation. Different people may have various preferences of IDE/editors, also the folder could be placed differently. So here you go.
FORCE_OPEN_CODE_EDITOR
When is not blank, config.open_code.editor
will be overridden.
Set to false
, off
or disabled
to disable the gem
$ /usr/bin/env FORCE_OPEN_CODE_EDITOR=off rails s
FORCE_OPEN_CODE_PLACE_HOLDER
When is not blank, config.open_code.place_holder
will be overridden.
$ /usr/bin/env FORCE_OPEN_CODE_PLACE_HOLDER='Open in VSCodium' rails s
FORCE_OPEN_CODE_ROOT_DIR
When is not blank, config.open_code.root_dir
will be overridden.
$ /usr/bin/env FORCE_OPEN_CODE_ROOT_DIR='/my/project/path' rails s
FORCE_OPEN_CODE_LOGGER_URL
When is not blank, config.open_code.logger_url
will be overridden.
Set to false
, off
or disabled
to disable this functionality. Blank value will be ignored. All other values will enable this functionality.
$ /usr/bin/env FORCE_OPEN_CODE_LOGGER_URL=on rails s
This functionality requires localStorage.
_openCode.settings()
Should return keys below
disabled
iconUrl or placeHolder - you can only have one at the same time.
rootDir
scheme - same as config.open_code.editor
linkBuilder - a function to build href
. Default builder:
function (scheme, rootDir, path, line) {
return scheme + '://file/' + encodeURI(rootDir + '/' + path + ':' + line);
}
_openCode.getValue(key)
Get individual value by given key.
_openCode.setValue(key, value)
Set individual value by given key.
_openCode.reset()
Reset all settings - back to default.
Changing this settings only applies to the current browser. It does not have any impacts to Rails app.
FAQs
Unknown package
We found that open_code-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.