Configuration vars don't show up


#1

Previously, I was using configDefaults. But I see there is now a config variable I can use, and configDefaults is completely omitted from the docs. Since configuration has been one of the biggest difficulties, I was pretty excited about this feature. I played around with it for a long time (like 2 hours) and can’t get it to show anything when I go to Settings -> Packages -> SeeingIsBelieving.

I then went through the first package tutorial, everything in there worked fine, but it didn’t deal with config. So I copied the example linked above and pasted it right in, but nothing shows up in the app’s config section.

I reloaded, restarted, copied from packages that do seem to work, validated the file syntax. I have no idea what to do with this, and I’d like to release soon since the latest changes broke my selectors, and my plugin won’t work correctly until I do.

Here is the body of the first package with the configuration that doesn’t show up:

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

  activate: ->
    atom.commands.add 'atom-workspace', "ascii-art:convert", => @convert()

  convert: ->
    # This assumes the active pane item is an editor
    editor = atom.workspace.getActivePaneItem()
    selection = editor.getLastSelection()

    figlet = require 'figlet'
    figlet selection.getText(), {font: "Larry 3D 2"}, (error, asciiArt) ->
      if error
        console.error(error)
      else
        selection.insertText("\n#{asciiArt}\n")

UPDATE Okay, just to prove the “is it turned on” type things (e.g. I was editing the right file), I hit the keybinding that embeds the ascii art. After I did this, the config was there in the settings. Then I added another config value, it was not there. When I reloaded, neither config value were there. Here is a screencap:

(looks like you have to click the image to see it. Probably too large)


Package configuration settings
Config vars of type object get lost / ignore schema
#2

You probably have activationEvents set for your package. If you do, your package isn’t actually activated until the keybinding is used. See this topic for more information:


#3

Yeah, that’s it, ty :slight_smile:

The suggested solution is to turn off Atom’s activation events, and then reimplement them, within the lib. That implies to me that the feature needs to be considered again, with real-world use cases in mind. Maybe config schema doesn’t belong in the module (perhaps declared in package.json)? Or maybe accessing a package’s settings should activate it, or be available as an activation event, since that’s the only way to get the config schema?

Anyway, might be worth mentioning on the config page, b/c unless I’m doing something different from everyone else, it seems like the kind of thing that will be very common, pretty difficult to diagnose for us dabblers.

Also, thanks for adding the config schema! My users used to edit config.cson directly, and when they messed that up, they took down all of atom! Also used to have lots of errors from incorrect positions in the config, or misspelled variable names or invalid values. So, it’s really really apprreciated that there’s a better interface for me to set the vars, and also for my users to modify them :slight_smile:

Another aside: Something that would make it a lot easier to diagnose things like this would be if I could get a view into the list of events that are occurring. e.g. if I could see that when I ran my key combo, it fired the “activate acii package” which then fired “define ascii config schema”, I’d realize that my config schema doesn’t get defined until my package is activated, which happens when I use the keybinding, b/c of the activation events list. If I was making more packages, I’d probably try to build it, but got a lot of other things I’m working on at the moment, so figure I’ll mention it in case anyone else thinks its a good enough idea to work on :slight_smile:


Settings no longer appear
#4

I created an issue for activating a package on viewing its settings here:


#5

I ran into the same problem, and finally found your answer here… Although, I looked everything and really didn’t know and couldn’t find this place where “activationEvents” is being set. Could you help me on this? Thank you!


#6

In the year between the last post here and now activationEvents has been renamed to activationCommands. It also appears in the package.json of a package. For example:


#7

offtopic:
What is the package you used to make the text big with text 2?