Comments (8)
It looks like npm install .
failed to compile the native node module oniguruma
?
Here are the steps to get the C++ toolchain installed on your machine:
https://github.com/nodejs/node-gyp#installation
from vscode-textmate.
I've done this and it still didn't work. A little more research makes me think the issue is that I have x64 node? I'll try running npm install
to compile it with x86 node later and see if that helps.
from vscode-textmate.
Yeah, especially if you use nvm
or you have recently switched node versions, it is possible that you have compiled the native node module for the wrong node version. I suggest to do a git clean -xfd
(will remove everything as if you cloned fresh!) in vscode-textmate
and run again npm install .
. You can then monitor the output and see what the C++ compilation is doing.
from vscode-textmate.
What node version should I be using? I tried 32-bit versions of 6.6.0 and 6.3.0 and I got a different error. I'm not sure if it is a step forward or backward:
Error: A dynamic link library (DLL) initialization routine failed.\r\n\\?\c:\path\to\extension\node_modules\vscode-textmate\node_modules\oniguruma\build\Release\onig_scanner.node
from vscode-textmate.
@hoovercj Can you please start fresh. All the messages you are getting indicate (from me googling them) that the native node module got somehow built for the wrong node version target.
Do it all inside one console without closing it in between the steps (to be certain to get the same environment).
- step1:
git clone https://github.com/Microsoft/vscode-textmate.git
- step2:
cd vscode-textmate
- step3:
npm install .
- step4:
npm run compile
- step5:
npm run test
If this does not work, please post in here all the output you get at each step and then we can go ask the node-gyp folks for further guidance.
from vscode-textmate.
Yes, I can try that tonight and let you know. Thanks!
What I'm trying to do, though, is use vscode-textmate in my own vscode extension until a proper API surfaces token information.
To accomplish that, do I need to do the steps above and copy it over to my extension? Because simply adding vscode-textmate to my extension's package.json isn't working.
from vscode-textmate.
Oh, finally the errors you're getting make sense ! ;)
In VSCode the runtime is not node, but electron. Therefore, you would need to compile oniguruma
(the native dependency of vscode-textmate
against the exact same electron version as VSCode ships with.
In stable/1.5.x that would be electron v0.37.6 and in insiders/1.6.x electron v1.3.5
For insiders/1.6.x Windows (from me looking at vscode's script\npm.bat
) the following environmental variables would be needed to get node-gyp to compile against the same electron version as VSCode:
set npm_config_disturl="https://atom.io/download/atom-shell"
set npm_config_target=1.3.5
set npm_config_arch="ia32"
set npm_config_runtime="electron"
set HOME=~\.electron-gyp
:: Now you can use npm
npm install .
That being said, you would need to compile vscode-textmate
's oniguruma on Windows, Mac and Linux 32/64 bit to get your extension working across all OSes. And you would need to implement some switching loading logic on your side, as node's require will not do that for you out of the box.
If I were you, I'd try loading the vscode-textmate
that already ships with vscode (the OS problem is solved). It is pretty black-magic, but you could load it via:
var tm = require(path.join(require.main.filename, '../../node_modules/vscode-textmate/release/main.js'));
from vscode-textmate.
Great, thanks! This seems to be working now.
Just as an added note in case anybody else finds this, I'm trying to use this in a language server extension so I have to evaluate require.main.filename
in the language client and pass it over with the initializationOptions
to get the right value.
from vscode-textmate.
Related Issues (20)
- Consider using end pattern as bail out for embedded languages HOT 12
- Scopes on Recursive Regex Cause Problems
- Nested `begin`/`while` rules do not continue past begin match HOT 3
- Misclassification of PHP syntax tokens HOT 3
- Matching multiline text HOT 2
- How to find all local variables? HOT 2
- JSON grammar without `filePath` parsed incorrectly as PList
- How to make the embedded language have corresponding language id
- Clarification about concurrent tokenization using multiple themes
- PHPdoc highlighting issue HOT 1
- Incorrect 'no more matches'? HOT 3
- Support for YAML-TMLanguage HOT 1
- How to create language dialects HOT 3
- TextMate grammar does not parse correctly under 1.86 HOT 8
- Expose scope comment in `IToken`
- `ruleStack.clone()` doesn't actually clone HOT 1
- JSON key `"id"` breaks the tokenizer
- Vscode HOT 1
- [Idea] markdown in js extension HOT 1
- `\\G` matches unicode character 0xFFFF `` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-textmate.