Skip to content

Filetype autocompletion suggests wrong filetypes #3215

@dmaluka

Description

@dmaluka

When typing set filetype and pressing Tab to autocomplete, some of the suggested filetypes are incorrect (there is no syntax highlighting for them). For example, sh is suggested, but the actual filetype for shell scripts is shell, not sh. So the user executes set filetype sh, and as a result, the syntax is not highlighted at all.

The reason is that the autocompleter simply returns the basenames of syntax *.yaml files, but some of those file names don't match filetype values inside those files. Here is the complete list of such non-matching filetypes:

% for f in runtime/syntax/*.yaml; do fname=$(basename $f | sed 's/\.yaml//'); ftype=$(awk '/filetype:/ {print $2}' <$f); [ "$fname" = "$ftype" ] || grep -H filetype $f; done
runtime/syntax/arduino.yaml:filetype: ino
runtime/syntax/ats.yaml:filetype: ATS
runtime/syntax/bat.yaml:filetype: batch
runtime/syntax/cpp.yaml:filetype: c++
runtime/syntax/csx.yaml:filetype: csharp-script
runtime/syntax/gentoo-ebuild.yaml:filetype: ebuild
runtime/syntax/gentoo-etc-portage.yaml:filetype: etc-portage
runtime/syntax/justfile.yaml:filetype: 'justfile'
runtime/syntax/kvlang.yaml:filetype: "kvlang"
runtime/syntax/mpdconf.yaml:filetype: mpd
runtime/syntax/objc.yaml:filetype: objective-c
runtime/syntax/pkg-config.yaml:filetype: pc
runtime/syntax/PowerShell.yaml:filetype: powershell
runtime/syntax/python3.yaml:filetype: python
runtime/syntax/reST.yaml:filetype: rst
runtime/syntax/sh.yaml:filetype: shell
runtime/syntax/sls.yaml:filetype: salt

Commit hash: c2c2b2a
OS: any
Terminal: any

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions