Questions tagged [syntax-highlighting]
Syntax highlighting is a feature of some text editors that display text (especially source code) in different colors and fonts according to the category of terms.
3,619
questions
0
votes
0
answers
15
views
Saving location of cursor in contenteditable div
I have a contenteditable div. I am trying to implement "on-the-fly syntax highlighting". Here's what I have so far:
const codeElement = document.getElementById('code');
// func to apply ...
1
vote
1
answer
45
views
How to set different colors each rows based on the number of spaces?
I want to change the text color to red on a line if it has 4 spaces, blue color if it has 8 spaces, 12 spaces to green and so on. I'm using .YAML format to achieve this, but the text always set to red ...
0
votes
1
answer
26
views
How can I highlight a term by clicking? [closed]
I have a highlighter in the window.
Enter image description here
After clicking on that, it highlights the words.
Enter image description here
But my problem is after clicking on the highlighter word, ...
0
votes
1
answer
79
views
Regex Not Capturing All Code Blocks in Multiline String in Rust
I'm working on a Rust project where I need to apply syntax highlighting to code blocks within a multiline string. These code blocks are similar to markdown, encapsulated by triple backticks with a ...
-5
votes
0
answers
67
views
My PHP code font color is red. How can I solve this issue?
I am using Microsoft VS Code.
I expected normal colors such as blue etc... which makes me uncomfortable, I just don't know may be its the new version release but I have tried the other language the ...
1
vote
0
answers
33
views
Intellisence and syntax coloring fail in vscode remote C/C++ development
In my local machine, the intellisense and syntax coloring work normally. But when I use SSH to connect to the remote server, somenthing goes wrong.
First, the syntax coloring can not correctly assign ...
1
vote
0
answers
39
views
Treesitter highlight ES6 html in javascript string
I'm trying to make a treesitter injection which will add html syntax highlighting to any string in an object, if the key the string belongs to is template, for example:
after/queries/javascript/...
0
votes
1
answer
19
views
How do i stop visual studio from highlighting only the current code block and fading out functions above and below?
I've been searching for a while, and cant figure this out - vs 2019 currently highlights the current scope of text and fades everything else. I don't know, but it's killing me.. and i can't figure ...
1
vote
1
answer
69
views
Getting start and end of tokens in string with regular expressions
I am trying to implement some kind of syntax highlighting for C programs in C itself. Imagine I have stored all the source code I want to highlight into a string, and before printing it, I would like ...
0
votes
0
answers
54
views
Is there a way to fix broken syntax highlighting in Visual Studio 2012?
I am currently working on a project that is based in Visual Studio 2012 and as soon as I start editing any source file, even if the syntax is correct and compiles, I still get broken highlighting.
...
0
votes
0
answers
16
views
VSCode editor.tokenColorCustomizations: Is there a way to set background colour for all HTML in a PHP document?
As the title says, I'd like to set my editor to put a background colour behind all HTML in a PHP document, or the other way around.
It seems like editor.tokenColorCustomizations would be the right ...
0
votes
0
answers
16
views
live syntax highlighting js
Live syntax highlighting as you type. I just want the code to highlight as i type and yes I'm aware of code mirror and other editor. I don't actually want a full code editor just a highlighted code as ...
1
vote
2
answers
45
views
Explicitely setting quote level colours for filetype mail in vim
In my system wide mail.vim syntax file for vim there are six quotation levels defined. However, it seems that there are only two different colours used alternately for even and odd levels. Is there a ...
0
votes
0
answers
54
views
How to syntax highlight in textarea in react
I need to apply syntax highlighting to a code written in a custom language in textarea in react.
So that as user type it highlights the code within the textarea and not to create a separate div or ...
0
votes
1
answer
36
views
How to put a marker in files for VSCode to use the language specified regardless of the file extension
For example, let's say you have a file called bla.yaml.tmpl and as the name ends with .tmpl, VSCode will not switch to YAML mode unless you manually do it or add it to some config.
I'm looking for the ...
0
votes
0
answers
33
views
Syntax highlighting in a Jupyter kernel for a custom language
I'm writing a custom Jupyter kernel for a small DSL. The kernel itself is mostly based on IHaskell as long as the reference implementation of the DSL is in Haskell, and mostly works. Now I'm ...
0
votes
0
answers
32
views
How to highlight code based on range and style
I have a lexer that generates token types and ranges, and I want to write a code highlighter.
I consider arranging the intervals in order according to the starting offset.
#[derive(Debug)]
pub struct ...
0
votes
1
answer
180
views
VS Code Python circa v2023.9/v2023.10 has reduced syntax highlighting, no snippets, and suggestions are forever "Loading..."
I have a problem with Python using VS Code. When I ran VS Code Python file was light out (all common variables and all libraries was white). Also when I write some variable it doesn't snippet (For ...
0
votes
0
answers
14
views
Syntax highlighting PHP variable in Codemirror 6 editor
Is there any option to highlight PHP variables in Codemirror version 6 editor. This was possible in version 5, but currently it looks like there is no such option in version 6.
0
votes
1
answer
41
views
How to fix a package from Sublime Text that doesn't read its color scheme?
note
> note.sublime-color-scheme
> note.sublime-syntax
> note.tmTheme
> sample.note
This is how my package structure called note looks like. I created and registered my custom ...
0
votes
0
answers
27
views
SwiftUI syntax highlighter autobracket undeletable
I have a syntax highlighting App that usually works fine but the auto brackets closing part doesn’t work. When I type ( it add ) but I can’t delete that, however when I move the cursor I somehow can ...
1
vote
1
answer
30
views
SwiftUI value not getting updated
I have a SwiftUI Texteditor and whenever I press the update button the color should be applied to the text however it just gets reseted to initialValue. Can anyone help me?
import SwiftUI
class ...
0
votes
1
answer
22
views
How to combine two syntax highlightings in one syntax file for sublime text?
I want to be able to syntax highlight files like Vue.js where javascript and css appear in the same file like so:
// Some JavaScript code
function hello() {
console.log("Hello");
}
====
...
1
vote
1
answer
49
views
Sublime Text 4: custom syntax highlight for specific YAML property names
I am writing a lot of OPEN API specifications in YAML, which contain some custom properties. Those properties are used by a script generating documentation from the specifications.
Anyways, I would ...
2
votes
2
answers
108
views
Next.js13 & Contentlayer Syntax-Highlight Error issues
making blog on Next.js13 with tailwind, contentlayer and for syntax-highlighting, tried to use rehype-pretty-code and rehype-highlight libraries; but some type error keep coming up and i have no idea ...
0
votes
0
answers
60
views
VsCode's syntax highlighting incorrect colors syntax for Java Development
Overview of incorrect syntax highlighting
Lines 24, 25 show incorrect syntax highlighting which is effected by how many new empty lines I have in-between the last declared variable, and
System out ...
0
votes
1
answer
19
views
Are there similar languages to Laravel Blade syntax-wise that I could use for approximate syntax highlighting where Blade isn’t supported?
I write documentation for a Web platform that uses the Laravel Blade engine to allow users to make and share scripts. Code snippets are often useful or necessary, and obviously syntax highlighting ...
0
votes
0
answers
33
views
Source Insight 4.0 can't parse '#' comments in x86assembly
I recently use Source Insight 4.0 to inspect the source code of Linux kernel, but find that SI cannot parses the comment starting with '#' correctly in x86 assembly file.
As SI doesn't parse the '#' ...
0
votes
0
answers
13
views
Omnipascal with Pascal Language Basics not working together
When installing Omnipascal VsCode extensions and Pascal Language Basics
extension, the latter wont work. Any ideas why? I would like to have the syntax highlighting from Pascal Language Basics and the ...
1
vote
0
answers
86
views
Selecting Preferred Extension for Syntax Highlighting in VS Code
Some background
I am using VS Code as my editor for writing Verilog code, and naturally want syntax highlighting. As such I can choose from one of several extensions which each provide their own ...
0
votes
1
answer
149
views
Intellij jenkins pipeline script syntax highlight / autocomplete
I have a file "Jenkinsfile" in a java project, and Intellij-idea 2023.1.4 will automagically do syntax highlighting and even some basic code completion for me (though it doesn't make use of ...
1
vote
1
answer
110
views
How do I add syntax coloring for my custom file type to Visual Studio (not Code)?
I have a custom (text-based) file type used by our applications. It's neither XML nor JSON nor YAML, but a custom format (a domain-specific language, if you want to call it that) that meets our needs. ...
0
votes
0
answers
56
views
Why is my JavaScript not registering with the IDE?
I'm working on a site that uses C#, Razor, ASP.NET Core, JavaScript, and SQL. At the moment, I'm trying to make a number of tables collapsible. However, when I tried adding the JavaScript to the ....
0
votes
0
answers
85
views
VSCode override semantic highlight with syntax highlight, for specific token types
Description
When a language extension marks class or void as keyword in semantic highlight, I cannot use syntax highlight rule to give them specific colours. For example, in this image, class static ...
0
votes
0
answers
30
views
Pygments style less accurate than Ace editor theme
The joined image shows a same syntax highlighted (LaTeX) code in two blocks codes, both with the same Dracula style/theme:
the first one with Pygments,
the second one with Ace Editor.
As one can ...
1
vote
1
answer
117
views
Flutter syntax highlighting not working after new UI In Android Studio Giraffe update
I updated my Android Studio to Android Studio Giraffe with new UI then my all Flutter projects' syntax highlighting and context menu suggestions stopped working.
I tried the following steps.
Restart ...
1
vote
1
answer
87
views
How to write an syntax highlight injection for vscode?
I am trying to write an injection grammar for pug to get JS and scss highlighting in the content of certain mixin calls.
//- Example Pug file
+module.
const myVar = {};
I'd like the contents to be ...
0
votes
1
answer
31
views
IntelliJ Ultimate Editor Syntax Highlighting for Jest
I am writing javascript unit tests using Jest in IntelliJ Ultimate.
Everything works great, and I can even run the tests right in the editor. There's just one thing I'd like to fix: the jest functions ...
0
votes
0
answers
15
views
why there's no changes in my syntax highlighting?
I tried to syntax highlighting my newly planned language but it doesn't seem to goes well. I successes to make it colorful once before, but then the progresses was gone, probably because I clicked don'...
2
votes
1
answer
85
views
Adding Heredoc syntax Highlighting in VSCode
I have a Rails project in which I'm using View Components. Inside most components, I have a erb_template HEREDOC which defines the components markup using ERB templated HTML.
When I set the HEREDOC ...
0
votes
0
answers
30
views
R Markdown: custom syntax highlighting style
I am trying to find the theme and syntax highlighting style used in R for data science book but apparently, they don't exist in the knitr library. If they are indeed custom styles, where can I find ...
1
vote
1
answer
28
views
Is it possible to get syntax highlighting and other editor services for html template literals in Svelte?
I wrote code that looks like:
<script lang="ts">
...
{
content: `
<p>
Some content
</p>
...
4
votes
0
answers
134
views
Unusable colors in Delphi 11.3 live code templates
I have recently upgraded to Delphi 11.3, and working out the wrinkles.
One problem I have is with the live code templates that Delphi shows as you type. I usually leave this enabled as it can be ...
0
votes
0
answers
36
views
vim syntax highlight match group doesn't match with all cases
I try to create a syntax highlight match group that match all words only with capital letters with underscores (constants in Java).
My definition:
syn match javaConstants "[A-Z_]\{2,}"
...
0
votes
1
answer
107
views
Paste Code in Microsoft Visual Studio has no Syntax Color highlighting
I have a problem when I copy code around in my solution in Microsoft Visual Studio (newest version). The pasted code doesn't have color highlighting; it's just white.
As seen in the picture, the &...
0
votes
0
answers
14
views
I exported some WSL2 commands to Win10 using Import-WslCommand - Including nano. How do I get syntax highlighting working (Esp. for Pwsh)?
I added:
Import-WslCommand "apt", "cat", "awk", "nano", "find", "grep", "head", "less", "ls", "man", ...
0
votes
1
answer
101
views
How to highlight syntax of block and inline comments in VSCode extensions?
This is my goal to achieve:
This is what I get:
My little syntax highlighting vscode extension looks like this:
package.json (significant excerpt)
"contributes": {
"languages"...
0
votes
0
answers
32
views
Different colorisation for global variable and local mutable variable?
In vscode, variables declared with let and variables declared with const are colorized differently. Yet there is no distinction between local and global variables. Is there a way to change the ...
0
votes
0
answers
23
views
google-colaboratory Linter does not work correctly with dynamically imported modules
When importing modules dynamically in Google Colab, the imported module and also the autocompletion work, but the Linter flags the imported module as an error, in this case, "np" is not ...
0
votes
1
answer
123
views
Vscode does not autocomplete on functional Enum in python
I am trying to create an Enum class using the functional API and wanted to have autocompletion once I call the enum class. However vscode does not seem to work if the Enum is created using a temp ...