diff --git a/frontend/src/lib/parsing.ts b/frontend/src/lib/parsing.ts index 2fd53d3..5aa3c8e 100644 --- a/frontend/src/lib/parsing.ts +++ b/frontend/src/lib/parsing.ts @@ -7,6 +7,26 @@ export const SUPPORTED_EXTENSIONS = [ ".md", ".py", ".json", + ".js", + ".ts", + ".tsx", + ".jsx", + ".go", + ".rs", + ".java", + ".c", + ".cpp", + ".h", + ".hpp", + ".html", + ".css", + ".yaml", + ".yml", + ".toml", + ".xml", + ".sql", + ".sh", + ".bash", ]; export function hasSupportedExtension(name: string): boolean { diff --git a/src/norefund/core/parsing.py b/src/norefund/core/parsing.py index 13e22a4..8e8eba9 100644 --- a/src/norefund/core/parsing.py +++ b/src/norefund/core/parsing.py @@ -7,7 +7,35 @@ logger = logging.getLogger(__name__) -SUPPORTED_EXTENSIONS = {".pdf", ".pptx", ".docx", ".txt", ".md", ".py", ".json"} +SUPPORTED_EXTENSIONS = { + ".pdf", + ".pptx", + ".docx", + ".txt", + ".md", + ".py", + ".json", + ".js", + ".ts", + ".tsx", + ".jsx", + ".go", + ".rs", + ".java", + ".c", + ".cpp", + ".h", + ".hpp", + ".html", + ".css", + ".yaml", + ".yml", + ".toml", + ".xml", + ".sql", + ".sh", + ".bash", +} def extract_text(path: Path) -> str: diff --git a/src/norefund/core/service.py b/src/norefund/core/service.py index 3da6922..4c96906 100644 --- a/src/norefund/core/service.py +++ b/src/norefund/core/service.py @@ -23,7 +23,35 @@ from norefund.logging_config import get_logger _LOG = get_logger(__name__) -_SUPPORTED = {".txt", ".md", ".pdf", ".pptx", ".docx", ".py", ".json"} +_SUPPORTED = { + ".txt", + ".md", + ".pdf", + ".pptx", + ".docx", + ".py", + ".json", + ".js", + ".ts", + ".tsx", + ".jsx", + ".go", + ".rs", + ".java", + ".c", + ".cpp", + ".h", + ".hpp", + ".html", + ".css", + ".yaml", + ".yml", + ".toml", + ".xml", + ".sql", + ".sh", + ".bash", +} @dataclass diff --git a/tests/test_desktop_api.py b/tests/test_desktop_api.py index 9597a8d..d83502a 100644 --- a/tests/test_desktop_api.py +++ b/tests/test_desktop_api.py @@ -148,6 +148,9 @@ def test_pick_files_filters_to_supported_extensions(): (pattern,) = kwargs["file_types"] assert "*.pdf" in pattern assert "*.docx" in pattern + assert "*.java" in pattern + assert "*.js" in pattern + assert "*.cpp" in pattern def test_pick_files_returns_empty_list_when_dialog_is_cancelled(): diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 78b760b..0803d02 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -5,11 +5,31 @@ from norefund.core.parsing import SUPPORTED_EXTENSIONS, extract_text -def test_supported_extensions_present(): - assert ".pdf" in SUPPORTED_EXTENSIONS - assert ".pptx" in SUPPORTED_EXTENSIONS - assert ".docx" in SUPPORTED_EXTENSIONS - assert ".txt" in SUPPORTED_EXTENSIONS +def test_supported_code_extensions_present(): + expected = { + ".js", + ".ts", + ".tsx", + ".jsx", + ".go", + ".rs", + ".java", + ".c", + ".cpp", + ".h", + ".hpp", + ".html", + ".css", + ".yaml", + ".yml", + ".toml", + ".xml", + ".sql", + ".sh", + ".bash", + } + + assert expected <= SUPPORTED_EXTENSIONS def test_extract_text_txt(tmp_path: Path):