-
Notifications
You must be signed in to change notification settings - Fork 453
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
Editor options of atom are ignored #894
Comments
I believe what you want is |
Yes I want an indent of 2. Maybe it has something to do with the "Migrate Settings" command I've triggered before. I think atom-beautify should use atom's options as default value, which can be then be overwritten per language. So I don't know whether it's a bug or a feature ;-) |
Similar to how CSS applies rules, Atom-Beautify favours specificity over general/default configuration. For instance, the per-language Atom-Beautify package settings will override the global/default
Overall, I recommend that you set the Atom-Beautify package settings to your desired configuration. If you want to have a default, you can add a For example: {
"_default": { "indent_size": 2 }
} |
I'm having the same issue. I tried reinstalling atom-beautify so it would load the default indent size from my editor options but it still set all the default indents to 4. |
One idea would be to add a "Rebuild Options" command to Atom-Beautif that would run the However, I will be unable to work on Atom-Beautify until May at the earliest, since I have my thesis and final exams to work on. My recommendation is for everyone to change their settings in Atom-Beautify package settings instead. |
I did a find and replace for |
+1 for having |
The temporary workaround I recommend is to add a {
"_default": { "indent_size": 2 }
} This will take precedence over both Atom's Editor and Atom-Beautify's package default settings, while being applicable for all languages and also not being required per project. This issue needs more discussion. Please provide your feedback. An idea of the top of my head: update selected language options on load using a new Language attribute. Instead of the following: # Get Atom defaults
scope = ['source.js']
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
defaultIndentSize = (if softTabs then tabLength else 1)
defaultIndentChar = (if softTabs then " " else "\t")
defaultIndentWithTabs = not softTabs
module.exports = {
name: "JavaScript"
namespace: "js"
# ...
###
###
options:
# JavaScript
indent_size:
type: 'integer'
default: defaultIndentSize
minimum: 0
description: "Indentation size/length" We can change it to: module.exports = {
name: "JavaScript"
namespace: "js"
# Add the language scope
scope: "source.js"
# Options that should look for default values from another option
option_aliases:
indent_size:
path: 'editor.tabLength' # => atom.config.get('editor.tabLength', scope: this.scope)
###
###
options:
# JavaScript
indent_size:
type: 'integer'
default: 4
minimum: 0
description: "Indentation size/length" If this issue affects you, please provide your feedback! Thanks! |
When you say UPDATE: The home directory is the home directory of your project. |
I am working on this right now. A couple changes:
I have it working right now: https://gist.github.com/Glavin001/5b388d3836f5319d3e055de77a151ead
which are set under for the |
@Glavin001 Thank you!! |
Looks like it will not be as simple as I had hoped. Setting the config defaults to Here is a snippet of the example schema I am testing: module.exports = {
general:
title: 'General'
type: 'object'
collapsed: true
order: -1
description: 'General options for Atom Beautify'
properties:
test1:
type: "integer"
default: null
test2:
type: "integer"
default: undefined
test3:
type: "integer"
default: 0
# ...
} Settings View uses However, executing {
"_analyticsUserId": "06c7bd24-f1e8-4120-b2b0-34f8e8d565e0",
"analyticsUserId": "a8e901dd-5205-4caa-804e-933219818e59",
"test3": 0,
"analytics": true,
"loggerLevel": "warn",
"beautifyEntireFileOnSave": true,
"muteUnsupportedLanguageErrors": false,
"muteAllErrors": false
} Notice So while I can get this feature to work it is at the cost of breaking Atom-Beautify's package settings as shown in Settings View. I think the best plan of attack is to fix Atom so it correctly adds the option to the schema instead of only showing a warning: https://github.com/atom/atom/blob/0e992326154d387611543f618ad5872dc4665586/src/config.coffee#L971 setRawDefault: (keyPath, value) ->
setValueAtKeyPath(@defaultSettings, keyPath, value)
@emitChangeEvent()
setDefaults: (keyPath, defaults) ->
if defaults? and isPlainObject(defaults)
keys = splitKeyPath(keyPath)
@transact =>
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
else
try
defaults = @makeValueConformToSchema(keyPath, defaults)
@setRawDefault(keyPath, defaults)
catch e
console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")
return Notice that within the The problem with editing Atom and/or Settings View is then users will be required to 1) wait for another Atom release and 2) must update their Atom such that they can use Atom-Beautify as they previously were. Without updating Atom, these changes to Atom-Beautify would appear to be breaking changes, as they will literally break the Settings View for certain Atom-Beautify 😞. |
Fixes #894. Default options are extracted from Atom Editor options
I've merged #1598 which should resolve these issues. Published to v0.29.21. |
Description
It seems, that atom-beautify is using it's own default options (since the better-settings change) and not atom's editor settings.
I'm not using a .jsbeautifyrc nor a .editorconfig
Expected Results
The beautified code should have looked like:
Steps to Reproduce
Atom Beautify: Beautify Editor
Debug
Here is a link to the
debug.md
Gist: https://gist.github.com/grma1/1ca0b62883e4294c333642e831762f48How to create
debug.md
GistNote that this will include a copy of your code.
If your code is private, please create a different sample of code that reproduces the problem.
search for and run the command
Atom Beautify: Help Debug Editor
.The debugging results will be copied to your clipboard.
debug.md
.debug.md
file in your Gist.Checklist
so I know this is not a duplicate issue
debug.md
Gist to this issueThe text was updated successfully, but these errors were encountered: