Associations added using files.assocations
lack sufficient information to distinguish between source files and header files.
#13184
Labels
VS Code has
files.assocations
, which allows file extensions/names to be associated with languages. We check that, to see if a file is C, C++, CUDA, or none of the above (falling back to hard-coded associations, usingis_file_supported
). However, VS Code doesn't provide a setting for distinguishing between source files and header files (as that's not a universal concept). Whenever we need to make that distinction, we leverage the VC commonis_valid_file
, with flags indicating whether we're checking for source or header - usuallyftf_compiled
vsftf_header
(with some additional checks forftf_idl
, which may not be needed. We associate.idl
with C++, but I'm not sure if that's valid).We've probably got some existing bugs related to
is_valid_file
not considering extensions/names added byfiles.assocation
.One thing we could do is, if
is_valid_file
fails butis_supported_file
succeeds, we could default to considering the file a source file (not a header). If a file had previously passedis_supported_file
, perhaps all checks forftf_compiled
could be changed to!ftf_header
, to entire the 'neither' case is always considered a source file.Another approach might be to add some hook in
is_valid_file
that falls back tois_supported_file
for any unhandled (not hard-coded) extensions, and assume they're source files (not headers). That way,is_valid_file
can at least return success for those instead of dropping them entirely.Ultimately, if we want to be able to distinguish between non-standard source and header extensions, we will need a new setting for it.
The text was updated successfully, but these errors were encountered: