Debian9下,如何让VSCode的Code Outline扩展支持Perl .cgi文件?
Got it, let's get your Code Outline extension working with .cgi files. Since VS Code already recognizes them as Perl, the issue is likely with how the extension filters which files to process. Here are some straightforward fixes to try:
1. Explicitly Map .cgi to Perl in File Associations
Even if VS Code shows "Perl" for .cgi files, setting this explicitly can clear up any hidden mapping quirks. Open your VS Code settings (press Ctrl+, or Cmd+), switch to the JSON view, and add:
"files.associations": { "*.cgi": "perl" }
Save and restart VS Code to apply the change.
2. Add .cgi to Code Outline's Supported File Extensions
Chances are, Code Outline is only looking for .pl files by default. You can update its settings to include .cgi. In your settings.json, add:
"code-outline.fileExtensions": [ "pl", "cgi", // Keep any other extensions you use here (like pm for Perl modules) ]
This tells the extension to process both .pl and .cgi files for outlining.
3. Ensure Perl is in Code Outline's Included Languages
Some outline extensions require you to explicitly list which languages they should work with. Check if Code Outline has an includedLanguages setting, and add "perl" if it's missing:
"code-outline.includedLanguages": [ "perl", // Add other languages you use here ]
4. Double-Check the Language Mode for .cgi Files
Just to be thorough:
- Open a .cgi file
- Look at the bottom-right corner of VS Code—you should see "Perl" displayed
- If not, click that label, select "Perl" from the dropdown, and choose "Configure File Association for '.cgi'" to set it as the default
If none of these steps work, try temporarily disabling other extensions to rule out conflicts, or reinstalling Code Outline to make sure you have the latest version.
内容的提问来源于stack exchange,提问作者a153

