Skip to content

Conversation

@WoozyMasta
Copy link

@WoozyMasta WoozyMasta commented Dec 22, 2025

Description

Implemented a custom FoldingRangeProvider to handle code folding based on brackets and regions, ignoring indentation breaks caused by preprocessor directives. Added visual decorations for conditional compilation directives, including nesting-based keyword coloring and inline logical context hints.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • I have tested these changes locally

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots

With feature Before
enscript-preproc-new enscript-preproc-old
Test File
#define EXPANSION_CORE
#define SERVER
#define DEBUG_VEHICLES

class ComplexTestModule
{
	void ProcessServerLogic() {};

#ifdef EXPANSION_CORE
	void Init()
	{
		Print("Core Initialized");

#ifdef SERVER
#ifndef RELEASE_BUILD
#define ENABLE_VERBOSE_LOGGING
#else
#define OPTIMIZED_MODE
#endif

		g_Game.Connect();
#endif
	}
#endif

	void Update(float dt)
	{
#ifdef EXPANSION_CORE

#ifdef SERVER
		ProcessServerLogic();

#ifdef ENABLE_VERBOSE_LOGGING
		Print("Verbose Update Tick");

#ifndef OPTIMIZED_MODE
		ValidateDataIntegrity();
#endif
#else
		Print("Standard Update");
#endif

#else
		ProcessClientLogic();

#ifdef DEBUG_VEHICLES
		RenderDebugShapes();
#endif
#endif
#endif
	}

	void GarbageCollector()
	{
#ifndef SERVER
		return;
#else

#ifdef ENABLE_VERBOSE_LOGGING
		Print("Starting GC...");
#endif

		array<Object> objects = new array<Object>;
#endif
	}
}

@WoozyMasta
Copy link
Author

Here's another example, because the example with the test file is overloaded with preprocessors.
When all the preprocessors are not visible on the screen in the ghost text tooltip, the condition imposed on this code is immediately clear.

изображение

@Koncord
Copy link
Owner

Koncord commented Dec 23, 2025

I'm a bit skeptical about modifying the rendering this way. Relying on decoration-generated comments to represent preprocessor logic could be misleading for users, because the editor displays comment-like text that is not actually present in the underlying source code. Let me think about it.

@WoozyMasta
Copy link
Author

I suggest making tooltips an optional feature.

@Koncord Koncord changed the base branch from main to develop December 23, 2025 19:41
@Koncord Koncord merged commit cd5de3d into Koncord:develop Dec 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants