Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Wrong code colors with specific template and macro code #267

Open
aeschli opened this issue Apr 4, 2018 · 5 comments
Open

Wrong code colors with specific template and macro code #267

aeschli opened this issue Apr 4, 2018 · 5 comments

Comments

@aeschli
Copy link
Contributor

aeschli commented Apr 4, 2018

From @maxco2 on April 4, 2018 3:20

Issue Type: Bug
wrongcolors

#pragma once

#include <type_traits>

#define IsPointDef(...) \
	template<> \
	struct IsPoint<__VA_ARGS__> \
		{\
		static const bool isPoint = true;\
				}

#define ArrayBasedPointDef(T) \
	IsPointDef(T); \
	template<> \
	struct IsArrayBasedPoint<T>:public std::true_type \
		{};



#define XYBasedPointDef(T) \
	IsPointDef(T); \
	template<> \
	struct IsXYBasedPoint<T>:public std::true_type \
{};

#define TypeTAndUIsPoint \
	template<typename T, typename U, class = typename std::enable_if<IsPoint<T>::isPoint>::type, class = typename std::enable_if<IsPoint<U>::isPoint>::type>

namespace Navigation
{
	namespace Utils
	{
		template<typename T>
		struct IsPoint
		{
			static const bool isPoint = false;
		};

		template<typename T>
		struct IsArrayBasedPoint
		{
			static const bool value = false;
		};

		template<typename T>
		struct IsXYBasedPoint
		{
			static const bool value = false;
		};

	}
}

VS Code version: Code 1.21.1 (79b44aa704ce542d8ca4a3cc44cfca566e7720f1, 2018-03-14T14:46:47.128Z)
OS version: Windows_NT x64 10.0.17133

Extensions: none
Reproduces without extensions

Copied from original issue: microsoft/vscode#47170

@aeschli
Copy link
Contributor Author

aeschli commented Apr 4, 2018

Looks similar than #185. The meta.preprocessor.macro.c scope sticks around

@Arcanemagus
Copy link

I'm unable to reproduce this using Atom v1.26.0-beta1 using the TextMate grammar:
image

That is using v0.59.3 of this grammar, can you try checking with that version?

@maxco2
Copy link

maxco2 commented Apr 8, 2018

@aeschli
I tested Atom v1.25.1 to color this code. Everything works fine.
atom

This bug can only reproduce on vscode.
I also checked c++/c.cson( v0.59.3) and cpp/c.tmLanguage.json(vscode v1.22) briefly.
Did‘t find crucial difference.

@aeschli
Copy link
Contributor Author

aeschli commented Apr 9, 2018

That's what I see in Atom:
image

You can see that the meta.preprocessor.macro.c scope sticks around.
VSCode gives color to that scope which causes the all blue rendereing (that is a bug), but the grammar actually end that scope after the #define's.

@Arcanemagus
Copy link

@aeschli Ah, this is only reproducible if the language is set to C++, not C as I initially tested with.

I can confirm that the scope "sticks" around, thanks for the clarification!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants