Perl: expose file_filter/ignore_dirs via ls_specific_settings (#1449)#1642
Perl: expose file_filter/ignore_dirs via ls_specific_settings (#1449)#1642weiconghe wants to merge 1 commit into
Conversation
|
The problem is that Serena's symbol index is exclusively determined by the
Therefore, the out-of-sync case is a problem, and changing the extensions in only one place won't give you the desired behaviour. We would need to modify the |
95ed201 to
ce67e46
Compare
|
Good catch — you're right that What I did:
The default Tests added ( |
|
There are further subtleties to consider: If a new project is activated following the activation of a project that reconfigured the file extensions, then the original extensions must apply; the reconfiguration must be undone.
|
ce67e46 to
de4b78e
Compare
|
Good catch on the cross-project leak — that's a real defect in my add-only approach. Once project A had added Implemented exactly as you suggested:
15 tests pass; |
de4b78e to
30bb6b8
Compare
|
Thanks — moved the reset below the |
…#1449) Perl::LanguageServer only indexes files whose extension is in its `perl.fileFilter` and skips directories in `perl.ignoreDirs`. Both were hardcoded in PerlLanguageServer, so projects whose Perl source uses non-standard extensions (e.g. .cgi / .psgi web handlers, which can dominate a mature codebase) had no way to make those files visible to symbol/reference queries without forking Serena (oraios#1449). Surface both lists through `ls_specific_settings["perl"]` (keys `file_filter` and `ignore_dirs`), defaulting to the existing values so behaviour is unchanged for current projects. The resolution lives in a pure static method `_resolve_filter_settings` so the config plumbing is covered by unit tests that don't require a Perl runtime. Keep Serena's symbol index in sync with the LS (oraios#1449, per review): `find_symbol` and symbol indexing are driven by `Language.PERL.get_source_fn_matcher()`, so adding an extension (e.g. .cgi) to `file_filter` alone would leave the matcher untouched and the extension's symbols invisible. Since that matcher is now a @cache'd per-language singleton, add a `FilenameMatcher.add_extensions()` mutator and call it from `PerlLanguageServer` so the configured extensions also reach the symbol index, the ignore checks, and language composition. Avoid cross-project leakage (per review): because the matcher is a process-wide singleton, extensions added for one project would otherwise persist into the next. `FilenameMatcher` now snapshots its initial configuration and exposes `reset()`, and `SolidLanguageServer.__init__` resets the matcher right after `self.language` is determined, so every activation starts from the language's defaults before the subclass re-applies its own `file_filter`. This complements 860c584 (which added .t to the default list as a surface-level fix) by addressing the root configurability gap that the maintainer acknowledged in oraios#1449.
30bb6b8 to
967472e
Compare
|
There was no Perl section yet, so I added |
Fixes #1449
What & why
Perl::LanguageServeronly indexes files whose extension is in itsperl.fileFilterand skips directories in itsperl.ignoreDirs. Both lists were hardcoded inPerlLanguageServer, so projects whose Perl source uses non-standard extensions — e.g..cgi/.psgiweb handlers, which can outnumber.pm/.plin mature Perl backends (the reporter's example: 825.cgivs 340.pm+ 285.pl) — had no way to make those files visible tofind_symbol/find_referencing_symbolswithout forking Serena.860c5841added.tto the defaultfileFilteras a surface-level fix (one more extension). This PR addresses the root configurability gap that the maintainer acknowledged in #1449:The reporter's proposed approach is exactly what's implemented here. Opening it myself since the issue has been idle for ~2 months after that invitation, with no PR or follow-up from the reporter. All diagnosis credit for the configurability direction goes to @aaronbamblett.
Change
Surface the two lists through
ls_specific_settings["perl"], mirroring the established pattern ingroovy_language_server.py:PerlLanguageServer.__init__now resolvesself._file_filter/self._ignore_dirsfromsolidlsp_settings.get_ls_specific_settings(Language.PERL), defaulting to the existing values, so behaviour is unchanged for projects that don't set the override.workspace/configurationhandler anddidChangeConfigurationnotification) read the instance attributes instead of the old class constant / inline literals._FILE_FILTERclass constant is replaced by module-level_DEFAULT_FILE_FILTER/_DEFAULT_IGNORE_DIRS, with the "keep in sync withLanguage.PERL.get_source_fn_matcher()" note preserved on the default.This follows serena's CONTRIBUTING.md scope ("small bug fixes" / "extend along existing lines" via PR without prior discussion), and the trusted-project gating added recently to
ls_specific_settingsapplies automatically.Verification
Added
test/solidlsp/perl/test_perl_config.py— 6 unit tests against the pure_resolve_filter_settingshelper, deliberately not requiring a Perl runtime (existing Perl integration tests are skipped whenPerl::LanguageServerisn't installed; these run everywhere):ls_specific_settingsis absentfile_filtermakes extra extensions (.cgi,.psgi) visible — the Perl: file extensions hardcoded to .pm/.pl — exclude legitimate Perl source like .cgi #1449 scenarioignore_dirsappliedLocal checks on Windows / Python 3.13:
CHANGELOG.mdupdated under "Language Servers".