Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 01 22:51

    oyvindberg on refactor-remote-cache

    (compare)

  • May 01 22:51

    oyvindberg on master

    Refactor run cache and sbt plug… (compare)

  • May 01 22:34

    oyvindberg on refactor-remote-cache

    Refactor run cache and sbt plug… (compare)

  • Apr 30 22:40

    oyvindberg on master

    Be more tolerant with missing d… (compare)

  • Apr 30 14:41

    oyvindberg on scala-ast-codec

    (compare)

  • Apr 30 14:41

    oyvindberg on master

    JSON codec for scala AST (#291)… (compare)

  • Apr 30 14:19

    oyvindberg on scala-ast-codec

    JSON codec for scala AST - Col… (compare)

  • Apr 30 09:45

    oyvindberg on master

    Update sourcecode to 0.2.6 (#29… (compare)

  • Apr 30 09:45

    oyvindberg on master

    Update fansi to 0.2.13 (#298) … (compare)

  • Apr 28 22:22

    oyvindberg on master

    Update sbt-mdoc to 2.2.20 (#295) (compare)

  • Apr 28 22:20

    oyvindberg on master

    Update scalatest to 3.2.8 (#296) (compare)

  • Apr 28 22:20

    oyvindberg on master

    Update os-lib to 0.7.6 (#299) (compare)

  • Apr 12 21:13

    oyvindberg on v1.0.0-beta32

    (compare)

  • Apr 12 21:13

    oyvindberg on gh-pages

    Deploy website Deploy website … (compare)

  • Apr 12 01:10

    oyvindberg on sbt15

    (compare)

  • Apr 12 01:10

    oyvindberg on master

    Support sbt 1.5.x along with 1.… (compare)

  • Apr 12 01:03

    oyvindberg on sbt15

    Support sbt 1.5.x along with 1.… (compare)

  • Apr 11 23:42

    oyvindberg on scala-ast-codec

    JSON codec for scala AST - Col… (compare)

  • Apr 02 21:46

    oyvindberg on reintroduce-circe-fork

    (compare)

  • Apr 02 21:46

    oyvindberg on master

    Revert "Prepare to release on m… (compare)

Øyvind Raddum Berg
@oyvindberg
@mn98 indeed you've been sheltered from js, that's how you write values to console :) console.log(a). It's kind of the same as println(a) except that the latter forces a toStringwhich often gives not useful info for js objects. OTOH logging with console.log writes the object in such a way that you can expand and collapse it and so on in the browser console
mn98
@mn98
@oyvindberg great, thanks very much for the patient explanation! I'll try to extract more info about the js object.
mn98
@mn98
Hi all, I'm translating some js into the ST-equivalent code. I'm noticing some ST-generated methods return things of type InstanceType[T]. Subsequent functions require arguments of type T or I need to subsequently access members on the instance of T. What's the correct way to do this?
mn98
@mn98
I worked around the above by not calling any methods that returned InstanceType[T], but I'd still be interested if anyone has a moment to educate me.
Øyvind Raddum Berg
@oyvindberg
@mn98 that translation you're doing, I suppose you're working with a javascript library that doesn't have typescript definitions? If that's the case it might be more worthwhile to contribute typescript typings to DefinitelyTyped, where a lot more people can use them and we can convert them to Scala later
Øyvind Raddum Berg
@oyvindberg
so about InstanceType, it's a rather interesting and unexplored corner of Typescript, also for me. The thing it does is that given a reference to a constructor function or class, you can get the type of the thing it instantiates
interface A{a: number}
declare const aCtor: new (a: number) => A;
// A2 = A
type A2 = InstanceType<typeof aCtor>
so this is an advanced topic, for which we have nothing close to a translation in Scala. In the converter we can actually implement this for concrete cases (InstanceType<MyClass>), but for generic cases (InstanceType<T>) I see no other solution than to output js.Any. It's not implemented because I've never seen it used
Øyvind Raddum Berg
@oyvindberg
so what do you do with this? find examples of how this library is used in javascript, translate and cast as necessary. If you need a reference to a Javascript class in Scala.js you have js.constructorOf available
mn98
@mn98
@oyvindberg thanks for the details, this is an especially advanced topic for me who only discovered console.log this week :-)
I'm playing around with GoJS basics and the react flavour, attempting to render all of this with Slinky. It looks like typescript definitions exist for both gojs and gojs-react. So far I've managed to get the canvas element (generated by GoJS) appearing in my html but no diagrams are rendering. If I manage to get the basic or 'hello world' diagrams working I'd be happy to add an example project to the existing ScalablyTyped collection.
Btw, it was the GraphObject.make functions that were returning InstanceType[T]. Instead, I'm instantiating the various diagrams/shapes/etc. and manipulating their properties directly, rather than using the make routines, which is also much easier to read.
mn98
@mn98
Of course, if the community already has an example then that would be excellent too.
domaspoliakas
@domaspoliakas:matrix.org
[m]
Hello everyone, I'm having a little trouble with scalably on windows. I have a project with remote cache set up, and when I build a project on ubuntu I can see the cache being pulled correctly, but when I try to build the same project on windows I don't even see the message of it trying to pull from the remote cache. Has anyone seen anything like this?
Øyvind Raddum Berg
@oyvindberg
@mn98 if you create a draft PR to https://github.com/ScalablyTyped/SlinkyDemos/ I'll help you make it work there
mn98
@mn98
@oyvindberg thank you, much appreciated!
Øyvind Raddum Berg
@oyvindberg
@domaspoliakas:matrix.org I've definitely seen some issues with that, and I've been meaning to add more debug output to more easily diagnose it. It's also a problem that I don't have access to a windows computer to test it
If you're willing to spend a little bit of time digging on your side and testing some snapshots I'll go ahead and add that debug output so we can get it fixed
domaspoliakas
@domaspoliakas:matrix.org
[m]
Yeah, I'd be delighted to help. Just let me know what to do
mn98
@mn98
@oyvindberg I pushed a skeleton demo for the GoJS "Hello World" diagram. Despite a clean compilation, I'm hitting a runtime error to do with the discovery of some of the GoJS types when running gojs/start. Presumably I've missed something obvious there?
mn98
@mn98

The error being:

[info] Bundling the application with its NPM dependencies
[error] ModuleNotFoundError: Module not found: Error: Can't resolve 'gojs-react/lib/types/components/Diagram'

which seems a bit confusing because Diagram is in gojs, not gojs-react, but then again I'm not 100% sure how the js/react/ST/Slinky magic works.

Øyvind Raddum Berg
@oyvindberg
@mn98 I pushed a commit now, to a branch with the same name in the parent repo, see ScalablyTyped/SlinkyDemos@3f9acc5
Error: Can't resolve 'gojs-react/lib/types/components/Diagram' is a result of using the tree shaking feature. I should probably label it as forever experimental and something which you can experiment with turning on after you have finished coding.
as for the rest, I'd say de-javascriptified code is so much easier to understand than the original example here https://gojs.net/latest/intro/react.html
@domaspoliakas:matrix.org I'll have a look tomorrow and let you know
mn98
@mn98
image.png

@oyvindberg thanks very much! Those "tweaked" methods are interesting, must confess I'm not sure what's happening there.
I tried to address the 'todo' by adding this and following your pattern:

class ArchetypeData(val text: String, val color: String) extends go.ObjectData
...
  diagram.toolManager.clickCreatingTool.archetypeNodeData = new ArchetypeData("new node", "lightblue")

but that resulted in a JS runtime error upon double clicking in the demo diagram (screenshot above).

Øyvind Raddum Berg
@oyvindberg
@mn98 try to change String in ArchetypeData to be js.UndefOr[String]
those tweaked methods (couldn't think of a better name, it was late :D) was just to account for a difference between typescript and scala. In Scala you cannot pass js.Any where a String is expected, but in typescript you can pass any where string is expected
mn98
@mn98
@oyvindberg js.UndefOr[String] worked!
mn98
@mn98
@oyvindberg I raised ScalablyTyped/SlinkyDemos#44 with that change.
Øyvind Raddum Berg
@oyvindberg
great @mn98 :)
Øyvind Raddum Berg
@oyvindberg
@domaspoliakas:matrix.org could you try version 1.0.0-beta32+8-1a2a84b1-SNAPSHOT please? You'll need to add resolvers += MavenRepository("sonatype-s01-snapshots", "https://s01.oss.sonatype.org/content/repositories/snapshots") as well in plugins.sbt
Run stPublishCache again from somewhere, and then try to open the project on that windows machine. It's possible that it works now, and in that case great
if not, run these two commands in sbt debug and stImport, on both the machine you published from and the machine you try to pull to. Then paste the output to a github issue or something like that
Domas Poliakas
@domaspoliakas:matrix.org
[m]
@oyvindberg: I'll get it done later today 👍️
Domas Poliakas
@domaspoliakas:matrix.org
[m]
Gave the snapshot a shot, but it seems the issue persists
I'll try to reproduce on a smaller scale and get those debug logs
Øyvind Raddum Berg
@oyvindberg
Right, thanks. If you get me those debug logs it may hopefully be easy to determine what goes wrong
Dan Di Spaltro
@dispalt

I have some autogenerated code from ST, that outputs this

@js.native
trait ColorAttrCallback extends StObject {

  def apply(args: js.Any*): String = js.native
}

which is a parameter to a function, since it has the js.native modifier I can't "new" it, any good ideas what people do in this scenario?

3 replies
Domas Poliakas
@domaspoliakas:matrix.org
[m]

Hello. Did a little bit of digging and I see that on windows the URL being requested is, for example

org.scalablytyped/google-libphonenumber_sjs1_2.13/7.4.20-5fe8c3/srcs/google-libphonenumber_sjs1_2.13-sources.jar

Whereas when importing from ubuntu it is

org.scalablytyped/google-libphonenumber_sjs1_2.13/7.4.20-f8667e/jars/google-libphonenumber_sjs1_2.13.jar

Note the different digest. I tried to read through the sources a little to see if I can find how it was generated, but got a little lost. Any clues?

Øyvind Raddum Berg
@oyvindberg
@domaspoliakas:matrix.org Yeah, ensuring consistent digests across machines has not been possible yet, though within the same machine it is consistent. That's mostly enough. When the remote cache is enabled every puller will just get the digests computed by the machine which computed the artifacts in the first place, which is hopefully good enough.
so if you can get me those debug logs that would be the best :)
Domas Poliakas
@domaspoliakas:matrix.org
[m]
The thing about the logs is that I may need to do some purging of potentially confidential things from it, and there's a lot of logs so I was trying to avoid it 😅
Maybe I'll work some more on a reproduction repo instead
If there's a particular subsection of the logs that you need I can also get that right now
Domas Poliakas
@domaspoliakas:matrix.org
[m]
That is, I assume that once the phase 1 compiler stuff kicks in the rest is irrelevant?
Øyvind Raddum Berg
@oyvindberg
Aha @domaspoliakas:matrix.org . Tomorrow I'll find an example of the relevant lines, and then you can send me a redacted diff or something
Domas Poliakas
@domaspoliakas:matrix.org
[m]
Don't worry about it, I'll get it up to phase 1 compiler, that's not a lot of logs to run through. I should be able to do it later today and I'll open a github issue with it as you suggested
Domas Poliakas
@domaspoliakas:matrix.org
[m]
I opened an issue with the logs now. I also tried to work on the reproduction a little, but I ran into a different issue on that. When I do stImport it seems to hang on fetching the cached run. The odd thing is that the cache settings are the same as on the main project that I opened the github issue about, and that project seems to be fine. The repro project is https://github.com/domaspoliakas/scalably-test
On that project, doing submodule/stImport fetches from the cache correctly on ubuntu, but seems to hang on windows

and that project seems to be fine

I mean stImport complains about files not found, but does not hang