Feature Request: Smart file name suggestion for untitled files by detecting specific extensions in top comments
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Feature Description
Currently, when saving an untitled file (e.g., Untitled-1), VS Code reads the very first line of text to suggest a file name in the "Save As" dialog. While helpful, it has two limitations when users write the intended file name in a comment at the top:
1. It only checks the literal first line. If there is a blank line or a different comment before it, the feature fails.
2. It includes comment characters (like `# ` in Python) in the suggested name, forcing the user to manually backspace and delete them every time.
### Proposed Solution
I would like to suggest a smarter detection mechanism for untitled files:
1. **Scan the first few lines:** Instead of looking only at line 1, look through the first 5–10 lines for any line containing a valid file extension (like `.py`, `.js`, etc.).
2. **Clean comment characters:** If a line like `# my_program.py` or `// script.js` is detected, automatically strip the comment symbols, slashes, and leading/trailing whitespaces before injecting it into the "Save As" field.
This would drastically speed up the workflow for developers who prefer to draft quick code and quickly save it without using heavy AI extensions or leaving the keyboard. Thank you!
sample:
# logger.py
###############################################################################
# ProjectBuilder
#
# EPIC.......: 004
# Sprint.....: 4.7
# Arquivo....: builder/discovery/logger.py
# Versão.....: 1.0
#
# DESCRIÇÃO
# Logger do processo de Discovery.
#
###############################################################################
Contributor guide
Assessment
This issue has not been assessed yet.