Skip to content

File Extension Detection and Commenting Feature #19

Merged
chrisdedman merged 9 commits intomainfrom
commentCode
Mar 21, 2025
Merged

File Extension Detection and Commenting Feature #19
chrisdedman merged 9 commits intomainfrom
commentCode

Conversation

@chrisdedman
Copy link
Copy Markdown
Member

This update improves the CodeEditor component by adding:

  1. File Extension Detection

    • Implemented getFileExtension() to retrieve the file extension of the currently open file.
  2. Code Commenting/Uncommenting

    • Added addLanguageSymbol(QTextCursor &cursor, const QString commentSymbol)
      • Supports both single-line and multi-line selections.
      • Automatically applies or removes the appropriate comment symbol based on the file type.
    • Implemented addComment(), which:
      • Detects the file extension.
      • Applies the correct comment symbol for C++, Java, Python, YAML, SQL, Bash, JSON, and Go files.

This feature improves the code editor by streamlining the process of toggling comments shortcuts, improving productivity, and ensuring language-specific syntax correctness. 🚀

Supported Comment Symbols in this PR

File Type Comment Symbol
C/C++, Java, Go, JSON //
Python, YAML, Bash #
SQL --

@chrisdedman chrisdedman added the enhancement New feature or request label Mar 19, 2025
@chrisdedman chrisdedman self-assigned this Mar 19, 2025
@chrisdedman chrisdedman moved this to In Progress in CodeAstra MVP Mar 19, 2025
@chrisdedman chrisdedman merged commit e93db75 into main Mar 21, 2025
@chrisdedman chrisdedman deleted the commentCode branch March 21, 2025 06:27
@github-project-automation github-project-automation bot moved this from In Progress to Done in CodeAstra MVP Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant