Skip to content

Line ends in grammar files #20

Closed
Closed

Description

@vors

I'm trying to adopt vscode-textmate for https://github.com/PowerShell/EditorSyntax testing.
From my very early test harness prototype, I found few issues with vscode-textmate.

If I'm trying to use a grammar file with "\n" line-endings on Windows (where usually it's "\r\n"), then reading a grammar file fails with this error

F:\dev\EditorSyntax\node-test\node_modules\vscode-textmate\release\main.js:1573
        var injections = this._locator.getInjections(rawGrammar.scopeName);
                                                               ^

TypeError: Cannot read property 'scopeName' of null
    at Registry.loadGrammarFromPathSync (F:\dev\EditorSyntax\node-test\node_modules\vscode-textmate\release\main.js:1573:64)
    at tokenizeCodeSnippet (F:\dev\EditorSyntax\node-test\index.js:33:31)
    at Main (F:\dev\EditorSyntax\node-test\index.js:53:13)
    at Object.<anonymous> (F:\dev\EditorSyntax\node-test\index.js:58:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)

Then, if I replace line-ends, everything works fine.

Activity

  1. alexdima commented on Sep 7, 2016

    @alexdima
    Member

    Can you share a minimal grammar that reproduces the problem? Is it in plist form, it could be a problem in node-fast-plist ?

  2. vors commented on Sep 7, 2016

    @vors
    Author

    I think I figured it out.
    The problem is unrelated to line-ends and to vscode-textmate at all.

    I have this line in my code

    exec('cmd /c "git show ' + gitCommitId + ":" + grammarPath + " > " + path + '"');

    This call is async and file content is not created at the moment when vscode-textmate is trying to read it.
    Sorry for the false alarm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions