Skip to content

[Bug] Syntax highlight breaks inside CommonMark list syntax (1.s) when surrounding render-unaffective indentation is not 0. #172

@RokeJulianLockhart

Description

@RokeJulianLockhart

Does this issue occur when all extensions are disabled?:

Yes. Verified with code --disable-extensions.

VS Code Version:

code-1.99.3-1744761644.el8.x86_64:

Name            : code
Epoch           : 0
Version         : 1.99.3
Release         : 1744761644.el8
Architecture    : x86_64
Installed size  : 400.4 MiB
Source          : code-1.99.3-1744761644.el8.src.rpm
From repository : <unknown>
URL             : https://code.visualstudio.com/
Vendor          : Microsoft Corporation

OS Version:

  1. CPE_NAME="cpe:/o:fedoraproject:fedora:42"
  2. KDE Plasma Version: 6.3.4
    Kernel Version: 6.14.4-300.fc42.x86_64 (64-bit)
    Graphics Platform: Wayland

Steps to Reproduce:

Invoke the undermentioned content in a CommonMark editor tab:

<style>
	:root
		{
			--font-size: 10pt; /* 1em */
		}
	:not(h1)
		{
			font-size: var(--font-size) !important;
		}
	:is(h2, h3, h4, h5, h6)
		{
			margin-top: var(--font-size) !important;
		}
</style>

# Addition and Subtraction of Binary

1.	## Questions

	1.	1.	## Comprehension

			## Attempts

			1.	1.	~~~YAML
					 1010101 -
					 1010011
					 -------
					 0101110
					1 1 1
					~~~

					= 0101110

				2.	~~~YAML
					 1010101 +
					 1010011
					 -------
					 0101110
					1    11 
					~~~

					= 0101110

				How?!

				## Notes

				1. > 7 bits, (probably) *because* the first one determines the charge.

				2. What?

			1.	I've watched Craig and Dave, now, so I realise I need to leave the extraneous 0s and first 1 unflipped:

				~~~YAML
				     Pos :   1010101 +
				Orig Neg : ~~0101100~~
				Conv Neg : - 1010100
				       # :   -------
				  Answer :   1101101
				 Carried :    1 1   
				~~~

				AAARGH! How?!

			1.	~~~YAML
				     Pos :   1010101 +
				Orig Neg : ~~0101100~~
				Conv Neg : - 1010100
				       # :   -------
				  Answer :   0101001
				 Carried :  1 1 1
				~~~

				Woohoo!

		1.	## Evaluation

			1.	[~] Incorrect:

				## Calculations
			
				~~~YAML
				       1 : 00100111 +
				       2 : 10101111
				       # : --------
				  Answer : 11011110
				 Carried :  1 1111
				~~~

				## Remarks

				How can this be wrong? Two 1s should never become 0.

			1. [x] Correct:

				## Calculations

				~~~YAML
				       1 : 00100111 +
				       2 : 10101111
				       # : --------
				  Answer : 11010110
				 Carried :  1 1111
				~~~

				## Remarks

				1.	> You just have to treat 1 + 1 with a carried 1 and 0 + 1 with a carried one differently.

				1.	> Yeah, but how?

	1.	## Attempts
	
		1.	[x] Correct:
	
			~~~YAML
			       1 :  01111011 +
			       2 :  10111000
			       # :  --------
			  Answer :  00110011
			 Carried : 11111
			~~~

		1.	[x] Correct:

			~~~YAML
			       1 :  01111011 +
			       2 :  10111000
			       # :  --------
			  Answer :  00110011
			 Carried : 11111
			~~~

	1.	## Attempts

		1.	[~] Incorrect:

			~~~YAML
			       1 :  11100001 +
			       2 :  10111110
			       # :  --------
			  Answer :  00011111
			 Carried : 111
			~~~

		1.	[x] Correct:

			The left-most non-overflow unit should be 1⁄1, because, as the previous answer demonstrates, the sum of "1 + 1 with a carried 1 from a previous 0 + 1" is 1. That is because it's otherwise 0, so it can be replaced by 1.

			Consequently, the correct answer is:

			~~~YAML
			       1 :  11100001 +
			       2 :  10111110
			       # :  --------
			  Answer :  10011111
			 Carried : 111
			~~~

	1.	## Attempts
	
		1.	[~] Incorrect:
		
			~~~YAML
			     Pos :   10110101 +
			Orig Neg : ~~00111100~~
			Conv Neg : - 11000100
			       # :   --------
			  Answer :   11111101
			 Carried :  1    1
			~~~

		1.	[x] Correct:
		
			~~~YAML
			     Pos :   10110101 +
			Orig Neg : ~~00111100~~
			Conv Neg : - 11000100
			       # :   --------
			  Answer :   01111001
			 Carried :  1    1
			~~~

	1.	[x] Correct:
	
		~~~YAML
		     Pos :   10010111 +
		Orig Neg : ~~01011000~~
		Conv Neg : - 10101000
		       # :   --------
		  Answer :   00111111
		 Carried :  1   1
		~~~

	1.	[x] Correct:
	
		~~~YAML
		     Pos :   11011000 +
		Orig Neg : ~~01100000~~
		Conv Neg : - 10100000
		       # :   --------
		  Answer :   01111000
		 Carried :  1
		~~~

This shall cause significant inconsistencies amongst syntax highlights:

  1. Image

    Obviously, the selected ## Remarks should be blue, like its lower counterpart.

  2. Image

    The xs are not brown.

  3. Image

    None of the ~~~ (<pre><code>)s are highlighted.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions