Package configuration settings


#1

I’m trying to create a package that takes in some basic configuration settings. That I was hoping would be customizable from the Preferences tab.

I’ve figured out how to get and set some namespaced settings programmatically from the docs but I can’t find a way to make these settings customizable from the Preferences tab.

Looking at the atom/autocomplete code, it there is only one reference to atom.config, and nothing in any of the other files. So I’m wondering how exactly the autocomplete package manages to get this.

On a related note my package doesn’t show any of my hotkeys, which I know work.


How to execute node js child process from package?
#2

If you export a configDefaults object from your package’s main class then it will populate with defaults in the Settings view.


#3

It does exist but it is VERY basic… just check boxes and fields… no sliders, or (more importantly) drop down fields…


#4

Thanks I’ve got it!

Is there any plans for supporting more field types? Or possibly a way to add constraints?


#5

Is there any news on this? Radio buttons or a drop down would be very helpful.


#6

I think a better way to remove bracket-matching or otherwise configure it might be putting the following in your ~/atom/init.coffee file:

BracketMatcherPackage = atom.packages.getLoadedPackage("bracket-matcher")
BracketMatcherPackage.mainModule.pairedCharacters = {};

In case you want to do something fancier, the variable pairedCharacters above is defined and used in bracket-matcher/lib/bracket-matcher.js (On a mac, this is in /Applications/Atom.app/Contents/Resources/app/node_modules/).


#7

Atom now has, or will soon have, a config schema that enables all this in the package settings.


#8

Yep, it’s available as of v0.139.0 and documented here:


#9

I tried using the config schema in my package , The atom.config.get returns correct default values, but when I open Preferences -> Packages -> Settings, nothings shows up. I have no idea how to fix this, any hint?

Edit: I added my config in my my-package.coffee like this as shown in the API doc. Do I need to do something else to make the “Settings” section in Preference->Packages->My Package->Settings show up?

module.exports =  
  # Your config schema   
  config:    
    someInt:      
      type: 'integer'      
      default: 23      
      minimum: 1   

  activate: (state) -> # ..

#10

See this topic for one reason why they might not show up:


#11

Oh wow, thanks a lot! It 's really the activationEvents thing.


#12

A post was split to a new topic: How to read configuration settings?


#13

A post was split to a new topic: Path selector in Settings View