Is it possible to use extensions.getExtension('myExtension') from joyride or is it only available when building vscode extensions?
https://code.visualstudio.com/api/references/vscode-api#extensions
(.getExtension (.-extensions vscode) "myExtension")
(vscode/extensions.getExtension ..) should also work
Yes, that's how you do it. I'd use (vscode/extensions.getExtension "myExtension"). There is an example in the default user activate script. https://github.com/BetterThanTomorrow/joyride/blob/master/assets/getting-started-content/user/user_activate.cljs#L101
awesome, thanks!
you'll even get auto-completions for vscode/ext.. and vscode/extensions.get...
If this is not in an activation script you need it, @jarvinenemil, you can also use the special extension require syntax to get the extension's API. (ns ... (:require [" There's an example here: https://github.com/BetterThanTomorrow/joyride/blob/master/examples/.joyride/scripts/joyride_api.cljs#L3
is there a nifty way to find all public properties of a vscode extension? I tried via the repl but it always returns
#js ["id" "extensionUri" "extensionPath" "packageJSON" "extensionKind" "isFromDifferentExtensionHost"]
This is a bit limited in Joyride. What public properties are you missing there?
I expected e.g the joyride to show the joyride keys (e.g. isActive) when I tried to list all object keys
I simply want to list all props for any extension which I can use to do stuff 😄
I don't know why isActive doesn't show with js-keys. Or, rather, why the object does not include it, which you can see if you try
(js/JSON.parse (js/JSON.stringify joy))
There's something special about some of the properties.Maybe (js/Object.getOwnPropertyNames ..)?
Please file an issue about it, @jarvinenemil. I think there should be something we could do about it.
getOwnProperties is what we use for completions, isn't it, @borkdude? In any case it shows the same as js-keys does.
I think so, check the impl if you want to be sure
@pez issue created https://github.com/BetterThanTomorrow/joyride/issues/147
Thanks! I think the behaviour of js-keys might be defined in a way that Joyride should not change. The problem rather is that we lack a way to see all properties.
it's not clear to me what the expected behavior is. what is the JS invocation with the expected output?
@borkdude. The node repl shows all the properties for these objects. The expected behaviour is that we can see them from the Joyride REPL somehow. At least that's what I am lacking.
e.g. (.-isActive joyride) is not returned. But it's there.
I can get the missing properties like so:
(ns joyride.js-completions
(:require ["repl" :as node-repl]
["vscode" :as vscode]))
(comment
(def !completions (atom []))
(defn completions-cb [err result]
(if err
(js/console.error err)
(reset! !completions (-> result js->clj first))))
(def repl (.start node-repl))
(def context (.-context repl))
(unchecked-set context "ext" (vscode/extensions.getExtension "betterthantomorrow.joyride"))
(defn complete [s]
(.completer repl s completions-cb context)
@!completions)
(complete "ext.") => ["ext.__proto__"
"ext.hasOwnProperty"
"ext.isPrototypeOf"
"ext.propertyIsEnumerable"
"ext.toLocaleString"
"ext.toString"
"ext.valueOf"
""
"ext.activate"
"ext.constructor"
"ext.exports"
"ext.isActive"
""
"ext.extensionKind"
"ext.extensionPath"
"ext.extensionUri"
"ext.id"
"ext.isFromDifferentExtensionHost"
"ext.packageJSON"]
:rcf)(I did this in the joyride source code, but should work in Joyride as well?)
but what is the equivalent JS invocation that does show these? joyride supports JS scripts now - is it possible to make a repro in .js that does work?