Visual Studio Code: Paperscript











up vote
0
down vote

favorite












(sorry for my english skills) Did you know any ext or something to color paperscript code?



paperscript off colors example










share|improve this question


























    up vote
    0
    down vote

    favorite












    (sorry for my english skills) Did you know any ext or something to color paperscript code?



    paperscript off colors example










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      (sorry for my english skills) Did you know any ext or something to color paperscript code?



      paperscript off colors example










      share|improve this question













      (sorry for my english skills) Did you know any ext or something to color paperscript code?



      paperscript off colors example







      visual-studio-code paperjs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 30 '17 at 8:15









      maczlord

      33




      33
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it.



          To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it.



          index.html



          <script type="text/paperscript" canvas="myCanvas" src="index.js"></script>


          index.js



          // exactly the same code you had inline before
          for (var x = 0; x < 1000; x += 100) {

          for (var y = 0; y < 1000; y += 100) {

          var myCircle = new Path.Circle(new Point(x, y), 10);
          myCircle.fillColor = 'purple';

          }
          }





          share|improve this answer






























            up vote
            3
            down vote













            A similar issue re text/babel was raised here : https://github.com/Microsoft/vscode/issues/11781



            What you have to do is find the default VSCode html.json file and make a small edit



            On Windows it will be something like this : C:Program Files (x86)Microsoft VS Coderesourcesappextensionshtmlsyntaxeshtml.json



            On Mac you have to find the VSCode app in your Applications folder and right click 'Show package contents' and nav to /Contents/Resources/app/extensions/html/syntaxes/html.json



            You should find a codeblock like this (search for javascript)






            {
            "begin": "\G",
            "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
            "name": "meta.tag.metadata.script.html",
            "patterns": [
            {
            "include": "#tag-stuff"
            }
            ]
            },





            just add paperscript to the regex like this




            {
            "begin": "\G",
            "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
            "name": "meta.tag.metadata.script.html",
            "patterns": [
            {
            "include": "#tag-stuff"
            }
            ]
            },





            save the html.json and restart VSCode and you should be good to go.



            I have raised a request at https://github.com/textmate/html.tmbundle/issues to have this included by default






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44256968%2fvisual-studio-code-paperscript%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote



              accepted










              Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it.



              To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it.



              index.html



              <script type="text/paperscript" canvas="myCanvas" src="index.js"></script>


              index.js



              // exactly the same code you had inline before
              for (var x = 0; x < 1000; x += 100) {

              for (var y = 0; y < 1000; y += 100) {

              var myCircle = new Path.Circle(new Point(x, y), 10);
              myCircle.fillColor = 'purple';

              }
              }





              share|improve this answer



























                up vote
                2
                down vote



                accepted










                Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it.



                To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it.



                index.html



                <script type="text/paperscript" canvas="myCanvas" src="index.js"></script>


                index.js



                // exactly the same code you had inline before
                for (var x = 0; x < 1000; x += 100) {

                for (var y = 0; y < 1000; y += 100) {

                var myCircle = new Path.Circle(new Point(x, y), 10);
                myCircle.fillColor = 'purple';

                }
                }





                share|improve this answer

























                  up vote
                  2
                  down vote



                  accepted







                  up vote
                  2
                  down vote



                  accepted






                  Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it.



                  To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it.



                  index.html



                  <script type="text/paperscript" canvas="myCanvas" src="index.js"></script>


                  index.js



                  // exactly the same code you had inline before
                  for (var x = 0; x < 1000; x += 100) {

                  for (var y = 0; y < 1000; y += 100) {

                  var myCircle = new Path.Circle(new Point(x, y), 10);
                  myCircle.fillColor = 'purple';

                  }
                  }





                  share|improve this answer














                  Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it.



                  To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it.



                  index.html



                  <script type="text/paperscript" canvas="myCanvas" src="index.js"></script>


                  index.js



                  // exactly the same code you had inline before
                  for (var x = 0; x < 1000; x += 100) {

                  for (var y = 0; y < 1000; y += 100) {

                  var myCircle = new Path.Circle(new Point(x, y), 10);
                  myCircle.fillColor = 'purple';

                  }
                  }






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jun 21 '17 at 15:17

























                  answered Jun 21 '17 at 15:11









                  Aron

                  2,6772827




                  2,6772827
























                      up vote
                      3
                      down vote













                      A similar issue re text/babel was raised here : https://github.com/Microsoft/vscode/issues/11781



                      What you have to do is find the default VSCode html.json file and make a small edit



                      On Windows it will be something like this : C:Program Files (x86)Microsoft VS Coderesourcesappextensionshtmlsyntaxeshtml.json



                      On Mac you have to find the VSCode app in your Applications folder and right click 'Show package contents' and nav to /Contents/Resources/app/extensions/html/syntaxes/html.json



                      You should find a codeblock like this (search for javascript)






                      {
                      "begin": "\G",
                      "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                      "name": "meta.tag.metadata.script.html",
                      "patterns": [
                      {
                      "include": "#tag-stuff"
                      }
                      ]
                      },





                      just add paperscript to the regex like this




                      {
                      "begin": "\G",
                      "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                      "name": "meta.tag.metadata.script.html",
                      "patterns": [
                      {
                      "include": "#tag-stuff"
                      }
                      ]
                      },





                      save the html.json and restart VSCode and you should be good to go.



                      I have raised a request at https://github.com/textmate/html.tmbundle/issues to have this included by default






                      share|improve this answer

























                        up vote
                        3
                        down vote













                        A similar issue re text/babel was raised here : https://github.com/Microsoft/vscode/issues/11781



                        What you have to do is find the default VSCode html.json file and make a small edit



                        On Windows it will be something like this : C:Program Files (x86)Microsoft VS Coderesourcesappextensionshtmlsyntaxeshtml.json



                        On Mac you have to find the VSCode app in your Applications folder and right click 'Show package contents' and nav to /Contents/Resources/app/extensions/html/syntaxes/html.json



                        You should find a codeblock like this (search for javascript)






                        {
                        "begin": "\G",
                        "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                        "name": "meta.tag.metadata.script.html",
                        "patterns": [
                        {
                        "include": "#tag-stuff"
                        }
                        ]
                        },





                        just add paperscript to the regex like this




                        {
                        "begin": "\G",
                        "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                        "name": "meta.tag.metadata.script.html",
                        "patterns": [
                        {
                        "include": "#tag-stuff"
                        }
                        ]
                        },





                        save the html.json and restart VSCode and you should be good to go.



                        I have raised a request at https://github.com/textmate/html.tmbundle/issues to have this included by default






                        share|improve this answer























                          up vote
                          3
                          down vote










                          up vote
                          3
                          down vote









                          A similar issue re text/babel was raised here : https://github.com/Microsoft/vscode/issues/11781



                          What you have to do is find the default VSCode html.json file and make a small edit



                          On Windows it will be something like this : C:Program Files (x86)Microsoft VS Coderesourcesappextensionshtmlsyntaxeshtml.json



                          On Mac you have to find the VSCode app in your Applications folder and right click 'Show package contents' and nav to /Contents/Resources/app/extensions/html/syntaxes/html.json



                          You should find a codeblock like this (search for javascript)






                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          just add paperscript to the regex like this




                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          save the html.json and restart VSCode and you should be good to go.



                          I have raised a request at https://github.com/textmate/html.tmbundle/issues to have this included by default






                          share|improve this answer












                          A similar issue re text/babel was raised here : https://github.com/Microsoft/vscode/issues/11781



                          What you have to do is find the default VSCode html.json file and make a small edit



                          On Windows it will be something like this : C:Program Files (x86)Microsoft VS Coderesourcesappextensionshtmlsyntaxeshtml.json



                          On Mac you have to find the VSCode app in your Applications folder and right click 'Show package contents' and nav to /Contents/Resources/app/extensions/html/syntaxes/html.json



                          You should find a codeblock like this (search for javascript)






                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          just add paperscript to the regex like this




                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          save the html.json and restart VSCode and you should be good to go.



                          I have raised a request at https://github.com/textmate/html.tmbundle/issues to have this included by default






                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel)|application/((x-)?javascript|ecmascript|babel)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },





                          {
                          "begin": "\G",
                          "end": "(?i:(?=/?>|type(?=[\s=])(?!\s*=\s*('|"|)(text/(javascript|ecmascript|babel|paperscript)|application/((x-)?javascript|ecmascript|babel|paperscript)|module)[\s"'>])))",
                          "name": "meta.tag.metadata.script.html",
                          "patterns": [
                          {
                          "include": "#tag-stuff"
                          }
                          ]
                          },






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 20 '17 at 11:57









                          Perry Dyball

                          312




                          312






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44256968%2fvisual-studio-code-paperscript%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Feedback on college project

                              Futebolista

                              Albești (Vaslui)