zikaari / monaco-textmate Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammar.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/grammar.ts': Error: Can't resolve '../src/grammar.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js 17:18-38
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammarReader.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/grammarReader.ts': Error: Can't resolve '../src/grammarReader.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js 15:24-50
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/onigasm/lib/index.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/index.ts': Error: Can't resolve '../src/index.ts' in '/home/epatpol/Projects/Github/theia/node_modules/onigasm/lib'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-contribution.js 55:16-34
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/json.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/json.ts': Error: Can't resolve '../src/json.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammarReader.js 8:15-32
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/main.ts': Error: Can't resolve '../src/main.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js 55:24-50
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/matcher.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/matcher.ts': Error: Can't resolve '../src/matcher.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammar.js 8:18-38
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/onigasm/lib/onigasmH.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/onigasmH.ts': Error: Can't resolve '../src/onigasmH.ts' in '/home/epatpol/Projects/Github/theia/node_modules/onigasm/lib'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/onigasm/lib/index.js 3:19-40
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-contribution.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/registry.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/registry.ts': Error: Can't resolve '../src/registry.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js 14:19-40
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/rule.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/rule.ts': Error: Can't resolve '../src/rule.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammar.js 7:15-32
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/theme.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/theme.ts': Error: Can't resolve '../src/theme.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js 16:16-34
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
@theia/example-browser: WARNING in /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/utils.js
@theia/example-browser: (Emitted value instead of an instance of Error) Cannot find source file '../src/utils.ts': Error: Can't resolve '../src/utils.ts' in '/home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist'
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/grammar.js 6:16-34
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/node_modules/monaco-textmate/dist/main.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-service.js
@theia/example-browser: @ /home/epatpol/Projects/Github/theia/packages/monaco-textmate/lib/browser/monaco-textmate-frontend-module.js
@theia/example-browser: @ ./src-gen/frontend/index.js
I think this has something to do with the sourcemaps but I'm not sure how to fix it. Thing is I was trying to debug the frontend from within chrome/firefox and I couldn't access the monaco-textmate source files, which is a bit troublesome when debugging. Any ideas/workarounds to have sourcemap working when using webpack?
Following the example it says I still have to define getFilePath
for the RegistryOptions
, shouldn't that be removed for this monaco fork?
I am not sure whether issue is related with monaco-textmate
project or not. But, I don't know where to ask.
I am able to wire tmgrammers with monaco but colorization is not working as expected with tmthemes
.
expected colors (screenshot taken from vscode):
actual colors (screenshot taken from my project):
There is lot of difference between those two screenshots.
demo: https://codesandbox.io/s/monacowithtmgrammertmtheme-gc3o2
Any help is appreciated. Thanks
I'm using the following regular expression in a begin
pattern:
(?<=(\bregulatoryReference\b|\bdocReference\b))
(i.e., match this pattern if the previous token was regulatoryReference
or docReference
)
This works fine in Visual Studio Code. However, this package is throwing a
Uncaught Error: 105,110,118,97,108,105,100,32,112,97,116,116,101,114,110,32,105,110,32,108,111,111,107,45,98,101,104,105,110,100
findNextMatchSync@http://localhost:4300/main.js:184026:17
matchRule@http://localhost:4300/main.js:176562:31
matchRuleOrInjections@http://localhost:4300/main.js:176581:30
scanNext@http://localhost:4300/main.js:176699:34
_tokenizeString@http://localhost:4300/main.js:176690:5
57354/Grammar</Grammar.prototype._tokenize@http://localhost:4300/main.js:176394:36
57354/Grammar</Grammar.prototype.tokenizeLine@http://localhost:4300/main.js:176346:18
tokenize@http://localhost:4300/main.js:12508:33
tokenizeEncoded@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:746:9103
r@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:180:41836
_updateTokensUntilLine@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:180:40338
_tokenizeOneInvalidLine@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:180:39995
_backgroundTokenizeForAtLeast1ms@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:180:37862
h@http://localhost:4300/assets/monaco/min/vs/editor/editor.main.js:180:37585
...
When I change the regular expression to the equivalent following regex, this error isn't thrown and it works just fine.
(?<=(\bregulatoryReference\b)|(\bdocReference\b))
Does this package is compatible with Angular? If yes, how to do it?
When building Fluidd, we are getting a warning regarding the usage of Node's path
in rule.js
https://github.com/fluidd-core/fluidd/actions/runs/6633013725/job/18019933495#step:8:11
[plugin:vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/home/runner/work/fluidd/fluidd/node_modules/monaco-textmate/dist/rule.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
the grammar is loaded with only the scopename. So later the grammar always has languageid 0.
Thank you for this package Neek, it is the only Monaco + Textmate solution I was able to properly get up and running.
I'm using it to build the VS Code Theme Editor (post about it here), and this is extremely helpful!
One thing I wanted to let you know is that the current package does not work with the latest version of monaco-editor. I had to revert monaco-editor to version 0.19.x in order to get it properly working. The Monaco API has changed a little since you first released this.
Additionally, after using your monaco-vscode-textmate-theme-converter plugin, the syntax appeared like this:
In order to get it looking like the actual theme, I had to add two rules to the generated Monaco theme file which define the editor's background color, and the default text color:
After making these tweaks, here is the final result of how the syntax looks:
I might suggest adding info to the readmes about these two issues.
Thanks again Neek!
[email protected] npm package does not contain dist directory.
You may want to deprecate it and republish a fixed version ;)
Hi,
I was trying out this lib to get better highlighting in monaco. But I notices some major differences between the two, it doesn't have to be 100% the same, but my highlighting seems off and I was wondering if this behavior is known or whenever I maybe doing something wrong.
(Note the qoutes which are not highlighted as part of the string)
I got this weird difference in highlighting in all languages that I tried. I noticed that in codesandbox it worked perfectly but I couldn't reverse engineer if their tmLanguage files where different than mine. I copied them from my vscode installation folder.
For my setup I use webpack with the monaco-editor-webpack-plugin where I disabled all languages to use yours.
Package versions
"onigasm": "^2.2.2",
"monaco-editor": "^0.17.1",
"monaco-editor-textmate": "^2.2.0",
"monaco-editor-webpack-plugin": "^1.7.0",
"monaco-textmate": "^3.0.1",
Bootstrapping code, This is part of my code
import { wireTmGrammars } from "monaco-editor-textmate";
import * as monaco from "monaco-editor/esm/vs/editor/editor.api";
import { IGrammarDefinition, Registry } from "monaco-textmate"; // peer dependency
import { loadWASM } from "onigasm"; // peer dependency of 'monaco-textmate'
const grammars: IGrammarDescription[] = [
// .. other grammar files
{
language: "javascript",
scopeName: "source.js",
tmFileName: "JavaScript",
type: "json",
},
]
public async bootstrap() {
await loadWASM(require("onigasm/lib/onigasm.wasm"));
const registry = new Registry({
getGrammarDefinition: async scopeName => {
const g = grammarByScope.get(scopeName);
if (!g) {
throw new Error("No such grammar");
}
return {
format: g.type,
content: await (await fetch(
require(`../../../monaco/tmGrammars/${g.tmFileName}.tmLanguage.json`),
)).text(),
} as IGrammarDefinition;
},
});
for (const g of grammars) {
monaco.languages.register({ id: g.language });
}
await wireTmGrammars(monaco, registry, new Map(grammars.map(g => [g.language, g.scopeName])));
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.