syntax-highlighting

How to use monaco editor for syntax highlighting?

一曲冷凌霜 提交于 2020-08-27 06:42:36
问题 I developing a code based chat component. Every chat is some code snippet. For user input, I am using monaco-editor. It works fine. But as soon as user hits send button, I get raw input from Monaco editor. I need to append this user input to chat list and again highlight this input. Is there a way I can use Monaco editor to do this? Or do I have to use highlight.js along with Monaco? 回答1: I had the same problem so I created an issue #1171: https://github.com/Microsoft/monaco-editor/issues

How do I create an AvalonEdit syntax file (.xshd) and embed it into my assembly?

半城伤御伤魂 提交于 2020-07-31 18:31:18
问题 I'm trying to define some custom highlighting rules for AvalonEdit. There doesn't seem to be any documentation for this -- there's some documentation on the file format, but nothing on how to actually load and use the definition once you've created it. The "Syntax highlighting" wiki page (for the old WinForms TextEditor) documents how to load highlighting definitions from a .xshd file on disk, but I'd rather embed it as a resource, the same way AvalonEdit does with its built-in definitions. I

VSCode: change precedence of rules in custom TextMate grammar?

房东的猫 提交于 2020-06-17 22:57:45
问题 In a simple to-do list language grammar that I made, some scopes overlap in their regex rules, so certain scopes are not being recognized at all. I'd like to give these scopes precedence so that they're recognized within another scope. Currently it looks like this: The scopes are: urgent (red; lines starting with XXam/pm or * ) waiting (yellow; lines starting with ` ) url (purple; words starting with http ) tag (blue; words starting with @ ) I'd like tags and URLs to be colored even within

VS Code Syntax TypeScript Syntax Highlighting

落花浮王杯 提交于 2020-05-13 02:29:06
问题 I've recently started coding TypeScript in VS Code, but I did thought that the syntax highlighting is really bad. So I started to Google around and found out that at its best it could look like this: Mine looks like this: I am using TypeScript 2.0.3 and working on a mac 10.11.6. 回答1: What helped me was what @Reg1nleifr mentioned in their comment: Switching the color scheme. Go to Preferences -> Color Theme and change it to Dark+ (default dark) . 回答2: The syntax highlighting in VSCode is

syntax highlighting between matching parenthesis

ε祈祈猫儿з 提交于 2020-02-28 06:43:33
问题 Say I hava a LaTeX document open in Vim, and I want to highlight every occurence of {\color{red} ... } (where the dots are supposed to symbolize some contents), that is, I want to have {\color{red} , } and everything between these highlighted. This I have done with :syn region WarningMsg start=+{\\color{red}+ end=+}+ but I have the problem that, if I write something like {\color{red} some{thing} important} , then it is only {\color{red} some{thing} which gets highlighted, because Vim of

vim conceal with more than one character

我们两清 提交于 2020-02-26 09:23:11
问题 Actually I'd like to display -> with → (there is a space after the arrow) in haskell files. But I have the impression the conceal mechanism only work to replace -> by one character. An undesirable effect is visually bad indentation. Is there a way to achieve this? Thanks. Edit: Actually I use this, (from haskell.vim (conceal enhancement) plugin) syntax match hsNiceOperator "<-" conceal cchar=← 回答1: I do exactly what you want in C. The trick is to conceal each character separately, like so:

How do I get HTML syntax highlighting inside PHP strings & heredoc syntax?

大憨熊 提交于 2020-02-23 09:27:09
问题 I'm using Sublime Text with the Pastels on Dark theme. My language of choice is PHP. How can I get HTML syntax highlighting inside PHP strings & heredoc syntax? 回答1: Name your heredocs after the language you are using. This will syntax highlight in many text editors, including Sublime Text. For example: echo <<<HTML <!-- put HTML here and it will have syntax highlighting --> HTML; 回答2: Wanted to add this as a comment to Ol' Reliable's answer but I am not allowed yet. Whilst coding outside and

PHP syntax highlighting for .html files in Brackets.io Editor

北城以北 提交于 2020-02-04 13:39:25
问题 I work with a templating engine which is powered by .html template files. These templates also allow the use of PHP. Is it possible to enable PHP syntax highlighting for .html files? Update : As of Sprint 39, Brackets now allows you to include a ".brackets.json" file in your project directory which lets you map file extensions to languages. This will let you use php syntax highlighting within a html file. { "language.fileExtensions": { "html": "php" } } 回答1: Update 2: As of Brackets 0.42,

PHP syntax highlighting for .html files in Brackets.io Editor

断了今生、忘了曾经 提交于 2020-02-04 13:34:12
问题 I work with a templating engine which is powered by .html template files. These templates also allow the use of PHP. Is it possible to enable PHP syntax highlighting for .html files? Update : As of Sprint 39, Brackets now allows you to include a ".brackets.json" file in your project directory which lets you map file extensions to languages. This will let you use php syntax highlighting within a html file. { "language.fileExtensions": { "html": "php" } } 回答1: Update 2: As of Brackets 0.42,

Color (syntax highlighting) within an HTML <code> tag

不问归期 提交于 2020-01-28 16:25:42
问题 In a code fragment like the following ... class Foo { internal Foo() { for (int i = 0; i < 42; ++i); } } ... its various keywords and so on are color-coded when they're displayed in my browsers. When I do "View source", I don't see anything special in the HTML that would implement this color-coding. How and/or where is this syntax-specific color-highlighting implemented, then? For example is it built-in to the browsers, or is it implemented by site-specific JavaScript editing the DOM within