Coder Social home page Coder Social logo

vscode-generator-code's Introduction

Yo Code - Extension and Customization Generator

npm Package NPM Downloads Build Status License: MIT

We have written a Yeoman generator to help get you started. We plan to add templates for most extension/customization types into this.

Install the Generator

Install Yeoman and the VS Code Extension generator:

npm install -g yo generator-code

Run Yo Code

The Yeoman generator will walk you through the steps required to create your customization or extension prompting for the required information.

To launch the generator simply type:

yo code

The command generator

Generator Output

These templates will:

  • Create a base folder structure
  • Template out a rough package.json
  • Import any assets required for your extension e.g. tmBundles or the VS Code Library
  • For Extensions: Set-up launch.json for running your extension and attaching to a process

Command line

Usage:
  yo code [<destination>] [options]

Argument (optional):
  The destination to create the extension in, absolute or relative to the current working
  directory. Use '.' for the current folder.
  If not provided, defaults to a folder in the current working directory with the extension
  display name.

Options:
  -h,   --help                  # Print the generator's options and usage
  -i,   --insiders              # Show the insiders options for the generator
  -q,   --quick                 # Quick mode, skip all optional prompts and use defaults
  -o,   --open                  # Open the generated extension in Visual Studio Code
  -O,   --openInInsiders        # Open the generated extension in Visual Studio Code Insiders
  -t,   --extensionType         # ts, js, colortheme, language, snippets, keymap...
        --extensionId           # Id of the extension
        --extensionDescription  # Description of the extension
        --pkgManager            # 'npm', 'yarn' or 'pnpm'
        --webpack               # Bundle the extension with webpack
        --gitInit               # Initialize a git repo

Example usages:
  yo code                       # Create an extension in a folder with the extension's name.
  yo code . -O                  # Create an extension in current folder and open with code-insiders
  yo code Hello -t=ts -q        # Create an TypeScript extension in './Hello', skip prompts, use defaults.
  yo code --insiders            # Show the insiders options for the generator

Run Generator using Docker

If you don't want to install nodejs or any node packages, use this method to containerize the generator.

Go into your project directory.

cd <project directory>

Build the docker image from the docker file.

docker build -t vscode-generator-code .

Create a docker container with volumes.

docker run -it -v $(pwd):/usr/src/app vscode-generator-code

Local development

After making necessary changes, run npm link before running yo code to test the local version.

You can learn more about Yeoman generator development on its documentation website.

History

  • 1.0.0: Generates a VS Code extension for TypeScript 2.0.3
  • 0.10.x: Generates a VS Code extension for TypeScript 1.8.10

License

MIT

vscode-generator-code's People

Contributors

aeschli avatar alefragnani avatar alexr00 avatar bpasero avatar chrisdias avatar connor4312 avatar dbaeumer avatar dependabot[bot] avatar dimitropoulos avatar egamma avatar elliottsj avatar gilmoreorless avatar hawkticehurst avatar isidorn avatar jakewitcher avatar joandrsn avatar joaomoreno avatar joyceerhl avatar lramos15 avatar mjbvz avatar mrluje avatar nhedger avatar octref avatar rzhao271 avatar sibiraj-s avatar snpranav avatar tanhakabir avatar tomashubelbauer avatar tyriar avatar weinand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-generator-code's Issues

Yeoman prompt is repeated for each keystroke

When entering a theme URL or a theme name, the prompt text is repeatedly output. This doesn't happen when you enter the extension name.

? Enter the URL (http, https) or file name of the tmTheme file: (http://www.monokai.nl/blog/wp-conte
? Enter the URL (http, https) or file name of the tmTheme file: (http://www.monokai.nl/blog/wp-conte
? Enter the URL (http, https) or file name of the tmTheme file: (http://www.monokai.nl/blog/wp-conte
? Enter the URL (http, https) or file name of the tmTheme file: http://colorsublime.com/theme/downlo
ad/40759
? What's the name of your extension? theme-mine
? What's the name of your theme? This name will be shown in the color theme selection dialog: (Acai)
? What's the name of your theme? This name will be shown in the color theme selection dialog: (Acai)
? What's the name of your theme? This name will be shown in the color theme selection dialog: (Acai)
? What's the name of your theme? This name will be shown in the color theme selection dialog: (Acai)
? What's the name of your theme? This name will be shown in the color theme selection dialog: (Acai)

code generator for new language returns "languageFileName is not defined" error

Hello

I have been trying to play with your editor for new languages, but can't make it work unfortunately.

I used the option "new language support" with following data:

? 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/master/Syntaxes/Ant.tmLanguage.
? URL or file: https://github.com/ariatemplates/sublime-ariatemplates-highlighter/blob/master/Aria%20Templates.tmLanguage
? URL or file: https://github.com/ariatemplates/editors-tools/blob/master/subli
languageFileName raw = N-tmLanguage
? What's the name of your extension? at
? What's the name of your extension? at
? What's the identifier of your extension? (at) at
? What's the identifier of your extension? at
? What's the description of your extension? at desc
? What's the description of your extension? at desc
? What's your publisher name? (test) attest
? What's your publisher name? attest
Verify the id of the language. The id is an identifier and is single, lower-case name such as 'php', 'javascript'
? Detected languageId: () ariatemplates
? Detected languageId: ariatemplates
Verify the name of the language. The name will be shown in the VS code editor mode selector.
? Detected name: () ariatemplates
? Detected name: ariatemplates
Verify the file extensions of the language. Use commas to separate multiple entries (e.g. .ruby, .rb)
? Detected file extensions: () .tpl
? Detected file extensions: .tpl

and i get the following error:

languageFileName is not defined
    at eval (eval at <anonymous> (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\ejs\lib\ejs.js:485:12), <anonymous>:11:23)
    at returnedFn (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\ejs\lib\ejs.js:514:17)
    at Object.exports.render (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\ejs\lib\ejs.js:316:37)
    at copy.process (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\mem-fs-editor\actions\copy-tpl.js:14:18)
    at applyProcessingFunc (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\mem-fs-editor\actions\copy.js:13:16)
    at EditionInterface.exports._copySingle (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\mem-fs-editor\actions\copy.js:51:16)
    at EditionInterface.exports.copy (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\mem-fs-editor\actions\copy.js:23:17)
    at EditionInterface.module.exports [as copyTpl] (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\mem-fs-editor\actions\copy-tpl.js:12:8)
    at template (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\node_modules\yeoman-generator\lib\actions\actions.js:134:11)
    at module.exports.yeoman.generators.Base.extend._writingLanguage (C:\Users\rblineau\AppData\Roaming\npm\node_modules\generator-code\generators\app\index.js:565:10)

I tried to analyze a bit why filename would be missing, but without success for now.
Is it a known issue or perhaps my system setup is not inline with the tool ?

vsce package fails after creating new TS extension

With this change vscode:prepublish and compile point to tsc. If the user does not have tsc installed on their local system then vsce package will fail with this error.

Executing prepublish script 'tsc -p ./'...
Error: Command failed: tsc -p ./
'tsc' is not recognized as an internal or external command,
operable program or batch file.

I'm running on Windows 10 Pro version 1607.

If I change vscode:prepublish and compile to point to node ./node_modules/typescript/bin/tsc then vsce package works fine.

This suggestion here may also be a possible solution for this.

Missing npm test script

the generator contains a sample test, but it doesn't provide any information how to run the test. The convention is to put the command for testing into package.json into scripts. Could that be added? I'd add it myself, but I am not sure what the command is- is it mocha ?

Generator doesn't respond to arrow keys in Windows 10

I installed the latest version of the generator as pointed in here. After doing that the generator launches normally but I can't navigate among the various options with the arrow keys. This happens on Windows 10 environment. I don't know if it's relevant but the same happens to the asp.net yeoman generator. In OS X environment everything works file.

Why noLib in tsconfig.json?

I do notice some default function such as console is still available:
image

This make it harder to write extension?

Update dependencies

We should try to reduce some of the deprecated warnings

image

For example, there is now version 0.24.1 available for the yeoman-generator.

Error trying to add Standard ML grammar files for extension

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.

Generator for Language Support should work even if no URL/File is informed

Today, there is no way to start a fresh language, without informing a URL of File to convert. You have to inform something.

The yo code generator should have a template inside itself (maybe even the ant.tmLanguage), that could be used, instead of forcing a conversion process.

By the way, if you choose the ant.tmLanguage sample, but defines another name for your language (like xisto), it creates the package with your new name (xisto), but the .tmLanguage file is generated as ant.tmLanguage. The package.json file also refers the path to ant.tmLanguage.

Thanks

[Linux] yo duplicates text

  1. Linux, install generator
  2. Try to create a new extension, every time you are prompted in the terminal and you enter a character a line gets duplicated -> screenshot
  3. Not sure if this is under our control

screen shot 2015-10-02 at 11 16 00

Debugging extensions based on the Javascript generator works, those on Typescript timeout

I think I've outlined this pretty well here:

http://stackoverflow.com/questions/33811221/visual-studio-code-extension-host-timeout-during-debugging

Basically the problem is that when I actually try to debug the extension, those based on Typescript just result in timeouts of both sides of the debugging workflow.

In Javascript everything seems to work properly. I'm not sure if this is just a race condition based on the fact that the typescript must be compiled and thus pushes it outside the 3000ms timeout that Code seems to be willing to wait.

"Invalid publisher name" is unhelpful

The prompt What's your publisher name? is unhelpful at best. What's it asking me? My name? My company's name? I tried typing in my first and last name and it reponded with "Invalid publisher name". Only through tracking down the generator source code did I realise that I wasn't allowed to use a space in the name. I still don't know what the publisher name is for, or why I should care, or why it cares whether or not I use a space. You should make the error message a bit more helpful, and perhaps clarify the prompt, e.g. Who owns this project? (No spaces, please)

Error in PostInstall

Hi,

I get the following error in PostInstall.

35522 verbose lifecycle [email protected]postinstall: CWD: C:_temp\myext\myext
35523 silly lifecycle [email protected]
postinstall: Args: [ '/d /s /c', 'node ./node_modules/vscode/bin/install' ]
35524 silly lifecycle [email protected]postinstall: Returned: code: 1 signal: null
35525 info lifecycle [email protected]
postinstall: Failed to exec postinstall script
35526 warn [email protected] No repository field.
35527 verbose If you need help, you may report this error at:
35527 verbose https://github.com/npm/npm/issues
35528 warn [email protected] No license field.
35529 verbose If you need help, you may report this error at:
35529 verbose https://github.com/npm/npm/issues
35530 verbose stack Error: [email protected] postinstall: node ./node_modules/vscode/bin/install
35530 verbose stack Exit status 1
35530 verbose stack at EventEmitter. (C:\Users\x\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:255:16)
35530 verbose stack at emitTwo (events.js:106:13)
35530 verbose stack at EventEmitter.emit (events.js:191:7)
35530 verbose stack at ChildProcess. (C:\Users\x\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
35530 verbose stack at emitTwo (events.js:106:13)
35530 verbose stack at ChildProcess.emit (events.js:191:7)
35530 verbose stack at maybeClose (internal/child_process.js:877:16)
35530 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
35531 verbose pkgid [email protected]
35532 verbose cwd C:_temp\myext\myext
35533 error Windows_NT 6.1.7601
35534 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\x\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install"
35535 error node v6.7.0
35536 error npm v3.10.9
35537 error code ELIFECYCLE
35538 error [email protected] postinstall: node ./node_modules/vscode/bin/install
35538 error Exit status 1
35539 error Failed at the [email protected] postinstall script 'node ./node_modules/vscode/bin/install'.
35539 error Make sure you have the latest version of node.js and npm installed.
35539 error If you do, this is most likely a problem with the myext package,
35539 error not with npm itself.
35539 error Tell the author that this fails on your system:
35539 error node ./node_modules/vscode/bin/install
35539 error You can get information on how to open an issue for this project with:
35539 error npm bugs myext
35539 error Or if that isn't available, you can get their info via:
35539 error npm owner ls myext
35539 error There is likely additional logging output above.
35540 verbose exit [ 1, true ]

What am I doing wrong?

Remove yo code prompt defaults for URL or file locations

The Yeoman prompt defaults should be for values that the user might honestly want to use and shouldn't point to example URL locations. We shouldn't include a starting URL prompt default and can instead put an example URL in text above the prompt (using the Yeoman this.log("your message")).
Having users take the default theme http://www.monokai.nl/blog/wp-content/asdev/Monokai.tmTheme is odd since they should choose the theme they really want. We shouldn't default a .tmlanguage file either.
The current .tmlanguage path default is also not a good choice for an example as 'deadfoxygrandpa' may offend. Could we use a tamer but still instructive TextMate path such as http://raw.githubusercontent.com/textmate/ant.tmbundle/master/Syntaxes/Ant.tmLanguage.
The other defaults are fine since they have been seeded from the TextMate files and are good first choices for users.

Generated Theme package.json has npm warnings

Here's the console output:
I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
Your extension theme-mine has been created!

The description would be easy enough to add as "description": <%- JSON.stringify(themeName) %>.
The repository could also be the themeURL and that could also be used as the input to a README file. Not sure what would be appropriate for the license field.
Another option is to set "private": true to silence the warning output. This would be fine for the 0.9.0 release since the plug-in gallery won't be available until 0.10.0

Generator should validate input

e.g. not typing a name for an extension should not be allowed. should also check with possible ids for extensions and validate early.

Improve README for publisher templates

Many extensions are lacking in README content. We're hypothesizing that an improvement in the default README will help publishers improve their README content

Error when generating new language support without tmLanguage file

The docs at https://code.visualstudio.com/docs/tools/yocode indicate you can skip the tmLanguage file prompt by entering an empty name however when I tried this, I encountered an error:

torin:~/scratch/rego.tmbundle$ yo code

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

? 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/master/Syntaxes/Ant.tmLanguage.
? URL or file:
Error code

Problems loading language definition file: ENOENT: no such file or directory, open ''

vscode extensions

Hi,
I'm install: "npm install -g yo generator-code" and run: "yo code", but i can't select template "New Extension Pack". This template is not in menu.

Thanks for help.

Tomas

"categories": ["Others"] is no longer supported

Generator creates an extension with "categories": ["Others"]. When trying to publish this extension I get the following exception:

Error: Failed Request: Bad Request(400) - The category 'Others' is not available in language 'en-us'.

It seems that we should not use this category

`yo code` Fails when attempting to create a new language support extention

I've created a dummy test.tmLanguage file to initialize myself a new language using yo code. After filling in all the prompts, yo code crashes.

Here's the related error and entries, and the .tmLanguage file used:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>name</key>
	<string>Test</string>
	<key>scope</key>
	<string>test.test</string>
	<key>settings</key>
	<dict>
	</dict>
	<key>uuid</key>
	<string>A67A8BD9-A951-406F-9175-018DD4B52FD1</string>
</dict>
</plist>
> yo code             

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

? 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/master/Syntaxes/Ant.tmLanguage.
? URL or file: test.tmLanguage
? What's the name of your extension? Test
? What's the identifier of your extension? test
? What's the description of your extension? A test language
? What's your publisher name? testman
Verify the id of the language. The id is an identifier and is single, lower-case name such as 'php', 'javascript'
? Detected languageId: test
Verify the name of the language. The name will be shown in the VS code editor mode selector.
? Detected name: Test
Verify the file extensions of the language. Use commas to separate multiple entries (e.g. .ruby, .rb)
? Detected file extensions: .test
events.js:160
      throw er; // Unhandled 'error' event
      ^

ReferenceError: /usr/lib/node_modules/generator-code/generators/app/templates/ext-language/package.json:22
    20|         "grammars": [{
    21|             "language": <%- JSON.stringify(languageId) %>,
 >> 22|             "scopeName": <%- JSON.stringify(languageScopeName) %>,
    23|             "path": <%- JSON.stringify("./syntaxes/" + languageId + ".tmLanguage") %>
    24|         }]
    25|     }

languageScopeName is not defined
    at eval (eval at compile (/usr/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:498:12), <anonymous>:40:31)
    at returnedFn (/usr/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:529:17)
    at Object.exports.render (/usr/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:339:37)
    at process (/usr/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy-tpl.js:12:18)
    at applyProcessingFunc (/usr/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:13:16)
    at EditionInterface.exports._copySingle (/usr/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:51:16)
    at EditionInterface.exports.copy (/usr/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:23:17)
    at EditionInterface.module.exports [as copyTpl] (/usr/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy-tpl.js:10:8)
    at constructor.template (/usr/lib/node_modules/generator-code/node_modules/yeoman-generator/lib/actions/actions.js:134:11)
    at constructor._writingLanguage (/usr/lib/node_modules/generator-code/generators/app/index.js:563:14

I'm running:

OS:                     Arch Linux x64
Nodejs version:         v7.2.0

(installed fresh from npm)
yo version:             1.8.5
generator-code version: 1.1.4

Of course, the real issue here is #55. It's possible there might be something wrong with this dummy test.tmLanguage file, however there is no documentation anywhere I can find on how to create a new language definition. Either way, I would expect a crash during prompts would be a bug in any context.

Generator for snippets is a converter and not a generator

Allow snippets generator to create a new structure for code snippets when it don't find a existent snippet to convert.

The documentation (and genetator name) is not clear about what it really do.
"New Code Snippets" seems that it will create a new structure, not convert an existent snippet

Snippet Converted Not Working for literal Dollar Sign in Sublime Snippets

In sublime snippets, if you want to have a literal $ show up as part of the text the snippet inserts, you have to escape it with a backslash. When the snippet conversion runs as part of yeoman extension generator, it changes the $ that to a $ so when you use the snippet in VSCode, you get a $ inserted into your code of just the $.

Sublime Snippet

<snippet>
  <content><![CDATA[
\$scope.\$broadcast('scroll.infiniteScrollComplete');
]]></content>
  <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
  <tabTrigger>ionicbroadcastinfinitescroll</tabTrigger>
  <!-- Optional: Set a scope to limit where the snippet will trigger -->
  <scope>source.js</scope>
</snippet>

VS Code Converted Snippet

"ionicbroadcastinfinitescroll": {
        "prefix": "ionicbroadcastinfinitescroll",
        "body": "\n\\$scope.\\$broadcast('scroll.infiniteScrollComplete');\n",
        "description": "",
        "scope": "source.js"
    }

When Used in VS Code (Notice the $ instead of just $

\$scope.\$broadcast('scroll.infiniteScrollComplete');

Error when /home/node_modules is not readable

If /home/node_modules does not exist, you do not get this error. This only occurs when the directory exists but is not readable by the current user.

Why is it looking for this home directory to begin with? In sites with network home directories, it will try and mount /home/node_modules as well as /home/.yo-rc.json

/usr/lib/node_modules/yo/node_modules/glob/sync.js:321
        throw er
              ^
Error: EACCES, permission denied '/home/node_modules'
    at Object.fs.readdirSync (fs.js:666:18)
    at GlobSync._readdir (/usr/lib/node_modules/yo/node_modules/glob/sync.js:275:41)
    at GlobSync._processReaddir (/usr/lib/node_modules/yo/node_modules/glob/sync.js:135:22)
    at GlobSync._process (/usr/lib/node_modules/yo/node_modules/glob/sync.js:130:10)
    at new GlobSync (/usr/lib/node_modules/yo/node_modules/glob/sync.js:46:10)
    at Function.globSync [as sync] (/usr/lib/node_modules/yo/node_modules/glob/sync.js:24:10)
    at /usr/lib/node_modules/yo/node_modules/globby/index.js:55:35
    at Array.reduce (native)
    at Function.module.exports.sync (/usr/lib/node_modules/yo/node_modules/globby/index.js:54:19)
    at /usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/resolver.js:71:22

Reference Error when converting language

I am trying to convert https://github.com/ChrisJefferson/gap-tmbundle, which I have previously successfully converted to atom.

When running it through yo code, I get the following backtrace:

events.js:154
      throw er; // Unhandled 'error' event
      ^

ReferenceError: /usr/local/lib/node_modules/generator-code/generators/app/templates/ext-language/package.json:22
    20|         "grammars": [{
    21|             "language": <%- JSON.stringify(languageId) %>,
 >> 22|             "scopeName": <%- JSON.stringify(languageScopeName) %>,
    23|             "path": <%- JSON.stringify("./syntaxes/" + languageId + ".tmLanguage") %>
    24|         }]
    25|     }

languageScopeName is not defined
    at eval (eval at <anonymous> (/usr/local/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:485:12), <anonymous>:43:31)
    at returnedFn (/usr/local/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:514:17)
    at Object.exports.render (/usr/local/lib/node_modules/generator-code/node_modules/ejs/lib/ejs.js:316:37)
    at copy.process (/usr/local/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy-tpl.js:14:18)
    at applyProcessingFunc (/usr/local/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:13:16)
    at EditionInterface.exports._copySingle (/usr/local/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:51:16)
    at EditionInterface.exports.copy (/usr/local/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy.js:23:17)
    at EditionInterface.module.exports [as copyTpl] (/usr/local/lib/node_modules/generator-code/node_modules/mem-fs-editor/lib/actions/copy-tpl.js:12:8)
    at template (/usr/local/lib/node_modules/generator-code/node_modules/yeoman-generator/lib/actions/actions.js:134:11)
    at module.exports.yeoman.generators.Base.extend._writingLanguage (/usr/local/lib/node_modules/generator-code/generators/app/index.js:560:14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.