Skip to content

File Extension Detection and Commenting Feature #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 21, 2025
Merged

Conversation

chrisdedman
Copy link
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