proton

https://github.com/dvcrn/proton
dvcrn 2016-01-05T01:18:48.000686Z

finally back in the office

dvcrn 2016-01-05T01:18:55.000687Z

time to get some stuff done :simple_smile:

2016-01-05T01:36:42.000688Z

Nice, looking forward to it

2016-01-05T01:36:53.000689Z

I still have a couple layers to push out of my .proton

dvcrn 2016-01-05T02:07:24.000690Z

go for it!

dvcrn 2016-01-05T06:29:50.000691Z

@geksilla, @sglyon I pushed some changes that disable debug messages by default. Go into proton/config/proton.cljs and just set debug to true to get it back

2016-01-05T06:33:15.000692Z

Thanks for the heads up

2016-01-05T06:43:00.000693Z

@dvcrn: how happy are you with how we implemented the linter system?

dvcrn 2016-01-05T06:45:47.000694Z

I think in general the 'optional package' system (layers enabling / disabling packages) is not good yet

dvcrn 2016-01-05T06:46:09.000695Z

I also noticed that proton installed javascript linters for me even though I don't use the js layer

2016-01-05T06:50:08.000696Z

Hmm that’s odd.

2016-01-05T06:50:27.000697Z

Actually now that I think of it I saw that too — I just assumed I had the javascript layer on

dvcrn 2016-01-05T06:51:48.000698Z

yeah it seems like there is no check if the actual layer is enabled. It just pulls in all dependencies

dvcrn 2016-01-05T06:52:27.000699Z

moving register-layer-depenencies into init should fix this. Let me try

2016-01-05T06:52:48.000700Z

So do you have all the julia packages too? (question only makes sense if you don’t have the layer enabled, obviously)

dvcrn 2016-01-05T06:53:41.000701Z

the bug is with the implementation of (register-layer-dependencies

dvcrn 2016-01-05T06:53:52.000702Z

(register-layer-dependencies :tools/linter [:linter-clojure])

dvcrn 2016-01-05T06:54:14.000703Z

there is no way the package manager can filter based on this information that :linter-clojure should only get installed when the clojure layer is on

2016-01-05T06:54:27.000704Z

I thought it was kinda backwards there

dvcrn 2016-01-05T06:54:40.000705Z

I mean -

2016-01-05T06:54:55.000706Z

To me I would think that we’d have some method a layer can implement that specifies other layers as dependencies

dvcrn 2016-01-05T06:55:02.000707Z

when tools/linter is on, install linter-clojure but not: when tools/linter is on, AND clojure is on, install linter-clojure

2016-01-05T06:55:38.000708Z

So we kinda have a design question here

2016-01-05T06:55:54.000709Z

In the clojure layer we have a linter package

2016-01-05T06:56:20.000710Z

What you described above sounds to me like this package (clojure linting) will only work properly if BOTH tools/linter and lang/clojure are enabled

2016-01-05T06:56:44.000712Z

Is that the behavior you want?

dvcrn 2016-01-05T06:57:31.000713Z

well, the difference here is that register-layer-depenencies modifies state the moment it gets called. the other ones are multimethods that get called when core does it's thing. Moving the register-layer-dependencies call into init fixes this because it will not modify the state if init didn't get called which it only will when the layer is enabled. Might be a bit hacky though

2016-01-05T06:58:10.000714Z

That’s probably right, but I don’t love the solution

2016-01-05T06:58:49.000715Z

What’s the issue with having register-layer-dependencies be a multimethod just like the rest of the config methods?

dvcrn 2016-01-05T07:04:23.000717Z

hmm

dvcrn 2016-01-05T07:04:58.000718Z

you mean like register-layer-dependencies :lang/clojure :tools/linter [:linter-clojure]?

dvcrn 2016-01-05T07:05:05.000719Z

could work

2016-01-05T07:08:09.000720Z

That is kinda how I imagined it

dvcrn 2016-01-05T07:08:14.000721Z

In general, I think we should think a bit more about code structure

dvcrn 2016-01-05T07:08:22.000722Z

(I'm guilty of that too)

2016-01-05T07:08:42.000723Z

The lang/clojure layer depends on the tools/linter layer for linting support — if the user wants both, then install the linter-clojure package

2016-01-05T07:09:02.000724Z

Otherwise don't

2016-01-05T07:09:15.000725Z

BTW, moving the register-layer-dependencies call into init-layer worked just how you thought

2016-01-05T07:09:42.000727Z

The javascript linters were only installed when both the lang/javascript and tools/linter layers were enabled

dvcrn 2016-01-05T07:10:08.000728Z

I think we need a batter framework for disabling / enabling stuff dynamically

dvcrn 2016-01-05T07:10:15.000729Z

Really really don't like it the way we are doing it right now

dvcrn 2016-01-05T07:10:38.000730Z

My disabled packages look like this:

disabledPackages: [
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "linter-jshint"
      "atom-ternjs"
      "javascript-snippets"
      "autocomplete-modules"
      "docblockr"
      "react"
      "react-snippets"
      "linter-eslint"
      "linter-jshint"
    ]

dvcrn 2016-01-05T07:12:37.000731Z

I thought that might have solved it but apparently didn't:

(if (or (is-activated? package-name) force)
       (do
         (helpers/console! (str "disabling package " package-name))
         (.disablePackage packages package-name)))))

2016-01-05T07:12:49.000732Z

I had to rm ~/.atom/config.cson 3 times today because things got wacky

2016-01-05T07:13:05.000733Z

So I agree, it would be great to come up with something better

dvcrn 2016-01-05T07:14:22.000734Z

most settings should be completely stateless because we kill them anyway on start

dvcrn 2016-01-05T07:14:26.000735Z

just this damn disabledPackages

dvcrn 2016-01-05T07:14:27.000736Z

grrrrr

2016-01-05T07:15:19.000737Z

So the reason we can’t just completely wipe config.cson when proton starts is we try to remember things like toggles (disabled tabs, status bar, etc)?

dvcrn 2016-01-05T07:15:33.000738Z

we do that, just not the packages

dvcrn 2016-01-05T07:15:43.000739Z

because we had the problem that things got jumpy

dvcrn 2016-01-05T07:16:04.000740Z

like it deactivates and activates in too close time and then calls get ignored

dvcrn 2016-01-05T07:16:13.000741Z

so even though atom thinks tab-bar is disabled, it is not

2016-01-05T07:16:20.000742Z

Yeah… hmm. Is there anything we can hack on from the outside, or should we start looking at changes to core atom packages

dvcrn 2016-01-05T07:16:48.000743Z

we just need to make sure that disable-package can't multiple times disable something

dvcrn 2016-01-05T07:17:07.000744Z

so if linter-jshint is off, it will not get added to disabledPackages again

2016-01-05T07:17:35.000745Z

It probably isn’t as simple as reading in the config array, calling distinct, and writing it out again is it?

dvcrn 2016-01-05T07:17:51.000746Z

that's what I thought I did 😐

dvcrn 2016-01-05T07:18:02.000747Z

(defn is-activated? [package-name]
  (let [package-names (->> (.getActivePackages packages) js->clj (map #(.-name %)))
        filtered-packages (filter #(= package-name %) package-names)]
    (> (count filtered-packages) 0)))

dvcrn 2016-01-05T07:18:30.000748Z

ah wait, I misread