Shop OBEX P1 Docs P2 Docs Learn Events
Visual Studio Code - Page 2 — Parallax Forums

Visual Studio Code

245

Comments

  • cgracey wrote: »
    Roy has already transcribed and improved the Prop assembler into C**.
    Has Roy started working on adding P2 support to OpenSpin?

  • Heater.Heater. Posts: 21,230
    Rayman
    I think javascript might be too slow.
    A valid concern.

    Turns out that modern day Javascript engines are damn fast.

    For example try compiling Spin using OpenSpin in the browser here: http://propanel.oo.fi/lab/spine.html

    I believe it is very usable. Perhaps two or four times slower than than the natively compiled OpenSpin compiler.

    Or go crazy and do some serious 3D real-time rendering http://www.babylonjs.com/Demos/V8/

    Now, I'm not about to suggest using JS for serious micro-second resolution real-time work. But that is not what we are talking about here.

    So the best of both worlds is to write code in C++, which can be compiled to fast native code. Or it can be compiled to a bit slower JS with Emscripten.


  • Heater.Heater. Posts: 21,230
    Oh my God. What is going on?

    I just downloaded a .deb from Microsoft and installed it on my Debian PC.

    It runs.

    I feel very dirty all of a sudden, must take a shower.

    Perhaps when the nausea clears tomorrow I can check out what this thing can do.

  • Heater. wrote: »
    Turns out that modern day Javascript engines are damn fast.

    https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript

    This 30-minute video from 2035 (actually 2014) is very interesting.

    Post slide says:
    Everything through 2014 is true (subject to human fallibility), as is the "How Computers Actually Work" section. Firefox really could run CPython and Unreal Engine 3 in 2013. Everything from 2015 onward is, of course, fiction.
  • Heater.Heater. Posts: 21,230
    Circuitsoft,

    Brilliant. Thanks for that.

    JS has a lot of flaws, which everyone likes to make fun of. But then again so does every other programming language. He hits a good balance there.

    Currently we need C to write a kernel in. We need C/C++ to write a JS engine in. That's it.

    There are smart young guys working on exactly that. Boot to JS. No need for all that other junk that comes with a typical Linux installation.

    Everything else can be built on top of that.





  • cgraceycgracey Posts: 14,133
    Heater. wrote: »
    Turns out that modern day Javascript engines are damn fast.

    https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript

    This 30-minute video from 2035 (actually 2014) is very interesting.

    Post slide says:
    Everything through 2014 is true (subject to human fallibility), as is the "How Computers Actually Work" section. Firefox really could run CPython and Unreal Engine 3 in 2013. Everything from 2015 onward is, of course, fiction.

    That was an interesting talk. I wish we were there, already.
  • Heater.Heater. Posts: 21,230
    I think the problem is that after 50 years or more since computers started to proliferate it is not possible to take any program one might write and run it on any machine.

    They have different CPU architectures, they have different I/O, they have different graphical interfaces, different operating systems, etc, etc.

    This is shameful.

    C and C++ were supposed to paper over those differences. Or even ALGOL before that. The same code could be compiled to run everywhere. That fell down with the rise of closed source, binary only software delivery. Besides they needed to work to different APIs of different operating systems.

    Java was supposed to abstract things even further "write once, run anywhere". That did not work out in practice. And besides Java, as a language, is a brain dead language with no reason to exist.

    Then comes the net. And browsers. And the idea that a web page should work on any browser anywhere. OK, MS tried to sabotage that but luckily failed. In that web technology is HTML, CSS, the Document Object Model, and Javascript.

    All of a sudden JS is the universal language, if only because everything else failed.

    Notice how Microsoft's open source Visual Studio Code and the Atom editor are both based on JS and the web browser environment they run in.

    But then, it turns out that JS is an efficient "assembly language" that any other language can be compiled to.

    Who knows where all this leads.

  • RaymanRayman Posts: 13,797
    Java is big for server side apps.
    I was just at a University where I heard that some electrical & computer engineering students were upset that they had to take C++ and couldn't take Java...
  • jmgjmg Posts: 15,140
    Seairth wrote: »
    jmg wrote: »
    Maybe you could list the improvements needed to pnut, and the operations that then enables ?

    That's a good question. At the very least, it needs command-line options to compile a file and load it to the P2. That would be enough to use Code on top of pnut for the things we are currently doing. ...
    I thought that ability was added ? (or maybe I am confused, & it was something else..)

  • jmg wrote: »
    Seairth wrote: »
    jmg wrote: »
    Maybe you could list the improvements needed to pnut, and the operations that then enables ?

    That's a good question. At the very least, it needs command-line options to compile a file and load it to the P2. That would be enough to use Code on top of pnut for the things we are currently doing. ...
    I thought that ability was added ? (or maybe I am confused, & it was something else..)

    Was it? Hmm... I'd go searching for the details, but I've given up on the forum search feature.
  • Heater. wrote: »
    Oh my God. What is going on?

    I just downloaded a .deb from Microsoft and installed it on my Debian PC.

    It runs.

    I feel very dirty all of a sudden, must take a shower.

    Perhaps when the nausea clears tomorrow I can check out what this thing can do.

    Ha. Gotcha. Interested about your 'testing' and opinion.

    I am working with VS since 20+ years, so am used to the interface. It is quite consistent over the last 10 years and IMHO quite powerful.

    Don't feel dirty, you are just drawn like that...

    Mike
  • msrobots wrote: »
    Ha. Gotcha. Interested about your 'testing' and opinion.

    I am working with VS since 20+ years, so am used to the interface. It is quite consistent over the last 10 years and IMHO quite powerful.

    If you haven't used Code, it's quite different from VS.
  • Heater. wrote: »
    Circuitsoft,

    Brilliant. Thanks for that.

    JS has a lot of flaws, which everyone likes to make fun of. But then again so does every other programming language. He hits a good balance there.

    Currently we need C to write a kernel in. We need C/C++ to write a JS engine in. That's it.

    There are smart young guys working on exactly that. Boot to JS. No need for all that other junk that comes with a typical Linux installation.

    Everything else can be built on top of that.





    If it makes you feel any better, I just downloaded a deb package and installed it on windows
  • Heater.Heater. Posts: 21,230
    edited 2016-04-29 04:28
    msrobots,

    Testing and opinions will be forthcoming.

    This is "Visual Studio Code". That is Microsoft's way of saying that it has nothing at all to do do with the Visual Studio that you know and love. It certainly does not look anything like the VS I have used in the past, which was more than ten years ago I must admit. I'm sure it has no code in common with VS.

    At first glance it looks and feels more like the Atom editor, or Sublime. Which is a good thing. See Atom and VS Code side by side in the attached image.

    So far it has been up and running all night whilst I slept. Nothing happened, my machine did not crash, the house did not burn down, there was no plague of locusts.
    Don't feel dirty, you are just drawn like that...
    Oh my God. Am I coming out? What will I tell my family and friends? Will they understand?
    1348 x 580 - 126K
  • Cluso99Cluso99 Posts: 18,066
    I had a bit of a read about js and its syntax and operators. I was quite pleased with what I read.

    So VSC is an IDE for JS ? And it runs almost anywhere ? Are my assumptions correct???
  • David Betz wrote: »
    Roy Eltham wrote: »
    David Betz,
    If pnut still works the same as before, then only the "wrapper" stuff is delphi (which is not really pascal, it's derived from it). The actual guts of the compiler is in x86 ASM (using TASM to assemble it into a lib that Delphi imports).
    Yeah, I knew the assembler was written in x86 assembly. I just thought that if Chip were going to write it over in a high-level language, he might prefer Pascal to C/C++. I guess the best approach would probably be to get you to create OpenSpin2! :-)

    That is the plan, of sorts. I figured once Chip has locked down the hardware design and it's off being made, he'd work on Spin2 with Jeff Martin and Myself. I can get OpenSpin doing the P2ASM stuff pretty easily probably, but the plans previously discussed for Spin2 involved changes/additions/etc. that would likely be significant enough that we'd need to create a lot of new compiler code to go along with some of the pieces that exist in OpenSpin now.

    I'm sure Chip and Jeff will want to discuss it all here with all of the forum P2 folks as well, and involved whoever want to help that can...

  • Actually, Heater, I am quite sure there is code in common between Visual Studio 2015 (and the newer VS version 15, yes VS2015 is version 14). They do look and work different on some levels, but they have a some stuff that looks and works the same too.

    Cluso99, VSC is for pretty much any language, not just JS. I have used it for C/C++ code (mostly as a test, but it syntax highlights just fine and can be configured to run the files through a compiler. There are piles of extensions on the MS github and elsewhere that give it or extend it's support for various languages.
  • Heater.Heater. Posts: 21,230
    edited 2016-04-29 08:53
    @Roy,

    Nah, good old VS was written in C++. VS Code is written in Typescript, run as Javascript on Electron. Electron is a web based GUI for node.js. All of which runs on the V8 Javascript engine. The same software stack as the Atom editor. None of that existed till quite recently. It is developed from Visual Studio Online's editor, JS in the browser. I'm pretty sure it's all new code.

    @Clusso,

    VSC works with many languages, it can work with any language anyone wants to create plug-ins for. It runs on Windows, Mac and Linux. It even works on the Raspberry Pi http://www.hanselman.com/blog/BuildingVisualStudioCodeOnARaspberryPi3.aspx Moving forward it should be usable anywhere that can run V8 and Electron.

    So all wee need now is to create a VSC plugin that does Spin Syntax highlighting. Whist we are at it we could have a plug-in Spin compiler using OpenSpin compiled to JS with Emscripten. And a plug-in that loads binaries to Propellers. Perhaps another that makes a serial terminal.

    At that point we can throw away PropellerIDE and SimpleIDE.

    Of course we should have been doing all that with Atom editor plug-ins already. It's telling that when Atom arrived on the scene nobody took any notice. When MS does the same thing it's all the rage all of a sudden.


  • Cluso99Cluso99 Posts: 18,066
    edited 2016-04-29 10:07
    IIRC there is syntax highlighting for spin/PASM on Notepad++.
    Don't know if this ouldbe useful for any of this
  • Heater.Heater. Posts: 21,230
    There is Spin syntax highlighting in vim.
  • ErNaErNa Posts: 1,738
    and emacs!
  • Heater.Heater. Posts: 21,230
    msrobots,

    What is happening to me?

    For as long as I can remember I was a normal Linux lov'in guy who thought Microsoft was disgusting and anyone who leaned that way should be burned. Now I'm filled with strange and conflicting feelings.

    Today I find I have Microsoft Visual Studio Code installed on three machines. I find myself building a project using the Microsoft Babylon.js 3D and physics engine. http://www.babylonjs.com/Demos/V8/

    This morning I woke up with this enormous... urge to run out and buy a Microsoft Surface Pro 4. Seems I really want to go over the Edge.

    Perhaps it was that Microsoft Developer Day I went to a few months back. Some very nice young guys explained to me all about Microsofts new and Open Source friendly ways and how happy I would be in their cloud. They Azured me it was OK to feel this way.

    I'm beginning to suspect they put something in the free lunch or the free beer they were plying me with.

    Anyway. VSC has been working very well.
  • Heater. wrote: »
    Searith,

    Can't you define a regexp that matches any section name that is not the current section for the end pattern.

    start pattern for DAT section = /^DAT$/

    end pattern for DAT section = /^(CON)|(PUB)|(PRIV)|(OBJ)/

    Or something like that, I always have terrible trouble getting regexps to work.

    I figured it out! It turns out that this is the purpose for lookaheads!

    So, you get something that looks like this:
        {
          "begin":"(?i)^\\s*con\\b",
          "end":"(?i)(?=^\\s*(con|dat)\\b)",
          ...
        }
    

    Or, in straight JS, it would look like:

    start pattern: /^\s*con\b/i
    end pattern: /(?=^\s*(con|dat)\b/i

    Until now, I've never really understood lookaheads. The idea is that the matching expression inside the (?= ... ) can be matched, but won't be matched. As a result, the con or dat string will still be available to be matched to a later part of the regular expression (or, in the case of VSCode/Sublime/TextMate, matched by another regular expression later in the list).

    For those that have installed the extension, grab the latest syntaxes\p2asm.json and replace your local copy. It also covers a number of minor corrections. But, with respect to this issue, you should also now see slightly different coloring for CON sections and code folding might be a bit more behaved.

    Next, I want to figure out how to highlight tokens as constants in DAT when they are defined in CON. For that, I suspect I'll need to delve into the LanguageServer stuff.
  • by the way, I've also started working on a Spin version for the Propeller. Once I figure out a few more items, like the LanguageServer stuff, I will be adding that to the repository as well. In that case, I should also be able to use one of the existing command-line tools to compile and load the binaries. Which one(s) would you all recommend?
  • Heater,
    I stand corrected on any shared code between VS and VSC. However, you should know that with recent versions of VS it is a WPF application and managed code (most likely C# for most of it). The compilers/MSbuild and whatnot that the IDE uses are probably mostly still C++, but the IDE shell is not.

  • Heater. wrote: »
    This morning I woke up with this enormous... urge to run out and buy a Microsoft Surface Pro 4. Seems I really want to go over the Edge.
    I've noticed that the Microsoft Surface is used on a number of the TV shows my wife and I watch. I suppose that's because Microsoft pays for product placement in those shows but I've kind of started wanting one myself. I guess their money is well spent! :-)

  • Given the complexity of the P2, and the lack of inbuilt peripherals, what it really need is something like PSoC Creator.
  • cgraceycgracey Posts: 14,133
    edited 2016-04-29 16:37
    Given the complexity of the P2, and the lack of inbuilt peripherals, what it really need is something like PSoC Creator.

    Hopefully, P2 isn't so complex that people suppose everything must be configured ahead of time, before their main program runs.

    Programs that dynamically reconfigure the hardware will get a lot more out of the chip.

    I think our core manual doesn't need to be that big. Examples can take lots of room, but descriptions shouldn't. Everything in the Prop2 is intended to be thoroughly understood and exploited. There are no black boxes inside.
  • Cluso99Cluso99 Posts: 18,066
    edited 2016-04-29 17:33
    Smart Pins are somewhat complex to understand. However, there will be simple examples using them. Plus there will be P2 objects for sure.

    Objects made the P1 a breeze to understand and use. The vast majority have never even looked at FullDuplexSerial yet have used it easily. Using FDX is far simpler to use that programming a UART in other micros, and into the mix you get buffering and other supporting routines if you want, all without interrupting your main code.

    What I dislike about other micros are the registers that must be setup before you can even blink a pin, and often to understand this you need to read hundreds of pages.

    About six lines and you have a blinking pin (including clock definition). Cannot be any simpler than that!

    Some of the more complex P2 parts will only be programmed by the few who really want to make the P2 "sing". And many of those parts will become objects that are simple to use.

    How many of you wrote spin programs for P1 first before venturing into PASM? My guess is almost 100%. Some of you haven't even needed PASM.
  • cgracey wrote: »
    Hopefully, P2 isn't so complex that people suppose everything must be configured ahead of time, before their main program runs.

    No, it needs to be configured much earlier at the point they design their hardware.
Sign In or Register to comment.