microsoft / vscode-generator-code

Visual Studio Code extension generator
Other
1.29k stars 222 forks source link

Error trying to add Standard ML grammar files for extension #38

Closed andry-tino closed 8 years ago

andry-tino commented 8 years ago

I tried installing Standard ML language syntax for extension both from yo code and manually (creating the folder in extensions myself and adding package.json and syntaxes and copying syntax files). I get:

Error: The mode has failing when tokenizing the input

image

When I open code on a .sml file (I specified this extension).

Using the extension tool

If I use yo code, I get the following:

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |   Welcome to the Visual  |
   `---------´   |   Studio Code Extension  |
    ( _´U`_ )    |        generator!        |
    /___A___\    '--------------------------'
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? What type of extension do you want to create? (Use arrow keys)
? What type of extension do you want to create? New Language Support
URL (http, https) or file name of the tmLanguage file, e.g., http://raw.githubusercontent.com/textmate/ant.tmbundle/mast
er/Syntaxes/Ant.tmLanguage.
? URL or file: https://github.com/textmate/ocaml.tmbundle/blob/master/Syntaxes/OCamllex.tmLanguage
? What's the name of your extension? ocaml
? What's the identifier of your extension? ocaml
? What's the description of your extension? OCaml
? What's your publisher name? TextMate
Verify the id of the language. The id is an identifier and is single, lower-case name such as 'php', 'javascript'
? Detected languageId: ocaml
Verify the name of the language. The name will be shown in the VS code editor mode selector.
? Detected name: ocaml
Verify the file extensions of the language. Use commas to separate multiple entries (e.g. .ruby, .rb)
? Detected file extensions: .sml, .ml
events.js:154
      throw er; // Unhandled 'error' event
      ^

ReferenceError: C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\generators\app\templates\ext-language\vs
c-extension-quickstart.md:7
    5| * `package.json` - this is the manifest file in which you declare your language support and define
    6| the location of the grammar file that has been copied into you extension.
 >> 7| * `syntaxes/<%= languageFileName %>` - this is the Text mate grammar file that is used for tokenization
    8| * `<%= languageId %>.configuration.json` - this the language configuration, defining the tokens that are used for

    9| comments and brackets.
    10|

languageFileName is not defined
    at eval (eval at <anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-ge
nerator\node_modules\mem-fs-editor\node_modules\ejs\lib\ejs.js:485:12), <anonymous>:11:23)
    at returnedFn (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-generator\node_mo
dules\mem-fs-editor\node_modules\ejs\lib\ejs.js:514:17)
    at Object.exports.render (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-genera
tor\node_modules\mem-fs-editor\node_modules\ejs\lib\ejs.js:316:37)
    at copy.process (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-generator\node_
modules\mem-fs-editor\lib\actions\copy-tpl.js:14:18)
    at applyProcessingFunc (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-generato
r\node_modules\mem-fs-editor\lib\actions\copy.js:13:16)
    at EditionInterface.exports._copySingle (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_module
s\yeoman-generator\node_modules\mem-fs-editor\lib\actions\copy.js:51:16)
    at EditionInterface.exports.copy (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoma
n-generator\node_modules\mem-fs-editor\lib\actions\copy.js:23:17)
    at EditionInterface.module.exports [as copyTpl] (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\nod
e_modules\yeoman-generator\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:12:8)
    at template (C:\Users\myuser\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-generator\lib\actio
ns\actions.js:134:11)
    at module.exports.yeoman.generators.Base.extend._writingLanguage (C:\Users\myuser\AppData\Roaming\npm\node_modules\g
enerator-code\generators\app\index.js:562:14)

I filed this issue against TextMate but they replied that the grammar file is fine, so there must be something occurring in the extension manager in Code.

bpasero commented 8 years ago

@aeschli fyi

andry-tino commented 8 years ago

Any progress on this guys? I'm working on a Standard-ML project in Code but it is terrible without syntax highlighting :(

aeschli commented 8 years ago

You have to use https://raw.githubusercontent.com/textmate/ocaml.tmbundle/master/Syntaxes/OCamllex.tmLanguage instead of https://github.com/textmate/ocaml.tmbundle/blob/master/Syntaxes/OCamllex.tmLanguage. That one is just a HTML page.

andry-tino commented 8 years ago

It works for that, now I get the same issue when trying https://github.com/textmate/standard-ml.tmbundle/blob/master/Syntaxes/CM.tmLanguage :(

andry-tino commented 8 years ago

I tried an equivalent address by using the pattern of the other URI you provided but there is no resource at that URL... So basically the tmLanguage files provided in TextMate repo are not good?

aeschli commented 8 years ago

https://github.com/textmate/standard-ml.tmbundle/blob/master/Syntaxes/CM.tmLanguage is just a HTML page that shows an editor with the source code of the file. If you click on the 'raw' button, that brings you to the real URL of the content. When you run the yo generator, you need to feed in the content URL. Or maybe better, save the content to a local file an run the generator on that.

andry-tino commented 8 years ago

Oh man, I get the error now... Feel so stupid... Thanks!