[vim/vim] Add Faust filetype (PR #14894)

29 views
Skip to first unread message

Blake North

unread,
Jun 1, 2024, 7:39:21 AM6/1/24
to vim/vim, Subscribed

This adds the faust filetype for Faust .dsp and .lib files.

The .lib file extension was marked as being for COBOL files, but I couldn't find any evidence to support .lib being an extension that's used by COBOL (see sources below), so I reassigned it to Faust, which does use the .lib extension (example). If anyone can find a .lib file in COBOL, I'll gladly write a file type detector for it, but I would need to see it in order to know what I'm detecting.


Sources proving that COBOL doesn't use .lib:

  1. The Wikipedia article on COBOL does not list .lib as an extension
    image.png (view on web)
  2. Visual Studio's COBOL Language Support extension does not list .lib as an extension they detect as a COBOL file.
    image.png (view on web)
  3. The first 100 search results for .lib files on github are all in repos that do not contain any COBOL code
    (verified by hand)

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/14894

Commit Summary

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894@github.com>

dkearns

unread,
Jun 1, 2024, 11:34:16 AM6/1/24
to vim/vim, Subscribed

It might be a good idea to email the Cobol runtime files maintainer (Ankit Jain aja...@yahoo.co.in) and see if they can offer an explanation for this extension. It appears to have been assigned to Cobol for at least twenty five years.

Linguist doesn't recognise it as a Cobol extension either.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2143489384@github.com>

Christian Brabandt

unread,
Jun 1, 2024, 3:06:15 PM6/1/24
to vim/vim, Subscribed

Thanks. Another issue: *.dsp is already used for Makefiles


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2143551632@github.com>

Blake North

unread,
Jun 1, 2024, 3:18:09 PM6/1/24
to vim/vim, Subscribed

Yes, I just noticed that - I'll write a detector for it. It seems like checking for # characters at the beginnings of lines, no semicolons ; at the ends of lines, and looking for keywords like ifeq and endif could be a good way of doing this.

Example .dsp in Makefile: https://github.com/alberto-fc/csr-spi-ftdi/blob/21cda76812b916bb8e31097c389fe6b82fcb8512/obj-win32/Makefile.dsp
Example .dsp in Faust: https://github.com/magnetophon/lamb/blob/a2151cfd20c9827c92fb6fc092dc367b2b40d450/lamb.dsp

Also, I've never submitted a PR here before. Should this PR touch the same files as #12363?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2143554970@github.com>

Ankit

unread,
Jun 2, 2024, 3:22:12 AM6/2/24
to vim/vim, Subscribed

@PowerUser64 I think it is safe to remove .lib from COBOL filetype detector as it is not a standard COBOL extension. Standard types are .cbl and .cob and .cpy for copybooks.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2143729273@github.com>

Christian Brabandt

unread,
Jun 2, 2024, 10:09:28 AM6/2/24
to vim/vim, Subscribed

I think #12363 is a good example, which you can use as a template for you changes. Thanks for working on that.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2143868727@github.com>

Blake North

unread,
Jun 17, 2024, 9:33:54 PM6/17/24
to vim/vim, Push

@PowerUser64 pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/before/9abe90dd4f9348b4e5eaf319d9ccd5d6d420227b/after/81a57b13305d12a5b7d82d16cb59fc0f6c7e7a8a@github.com>

Blake North

unread,
Jun 17, 2024, 9:37:16 PM6/17/24
to vim/vim, Subscribed

Good news, it turns out that Make doesn't actually use the .dsp extension. Rather it's used by a discontinued program called Microsoft Developer Studio, hence the Developer Studio Project .dsp format. What's nice is these files are auto-generated, and all seem to have the same text at the top, "# Microsoft Developer Studio Project File". The format of the file is the same as that of Makefile, hence the association. I added in a few extra tests for things like keywords and comments for good measure.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2174743074@github.com>

Blake North

unread,
Jun 17, 2024, 10:11:00 PM6/17/24
to vim/vim, Push

@PowerUser64 pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/before/81a57b13305d12a5b7d82d16cb59fc0f6c7e7a8a/after/30d60283e467eb3fd42d179bf36e2a4c91cfb780@github.com>

Blake North

unread,
Jun 17, 2024, 10:26:25 PM6/17/24
to vim/vim, Push

@PowerUser64 pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/before/30d60283e467eb3fd42d179bf36e2a4c91cfb780/after/e5ea5b30abca4b087808ab16d3f462289b3f28bf@github.com>

Blake North

unread,
Jun 17, 2024, 10:49:07 PM6/17/24
to vim/vim, Subscribed

Cool, tests pass. By the way, any idea why https://github.com/vim/vim/actions/runs/9557808149/job/26345595245?pr=14894#step:11:15186 failed?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2174853612@github.com>

Christian Brabandt

unread,
Jun 18, 2024, 2:45:43 AM6/18/24
to vim/vim, Subscribed

Thanks, those 2 failing ones are known flaky ones.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2175249091@github.com>

Christian Brabandt

unread,
Jun 19, 2024, 2:32:06 PM6/19/24
to vim/vim, Subscribed

thanks, looks good now.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2179289055@github.com>

Christian Brabandt

unread,
Jun 19, 2024, 2:37:57 PM6/19/24
to vim/vim, Subscribed

Closed #14894 via aa61b8a.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/issue_event/13219886883@github.com>

Blake North

unread,
Jun 19, 2024, 6:29:29 PM6/19/24
to vim/vim, Subscribed

Thanks for the review!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c2179525537@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 4:36:29 PM (2 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#14894)

Just needed to fixed a local installation that use the nonstandard "lib" suffix :-) [all editors and COBOL compilers I know don't use that extension by default].

The only way I could work around that was to use --cmd to reserve .lib for COBOL. (That way the faust definition, which does not use !, don't override it`. Would there have been a better/cleaner way?)

A file detector would indeed be nice!
Most copybooks would start with several comment lines (1+), but those may look different depending on the dialect.

Side-note: "common" COBOL file types also include "pco" for Oracle Pro*COBOL and "sqb" for the DB2 preprocessor.
Rarely used but also seen: copy (and of course: all of the extensions in upper-case as well).

Has anyone contacted Ankit Jain and got a response [the syntax files are kinda outdated]?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c3293857350@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 4:51:26 PM (2 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#14894)

Just needed to fixed a local installation that use the nonstandard "lib" suffix :-) [all editors and COBOL compilers I know don't use that extension by default].

The only way I could work around that was to use --cmd to reserve .lib for COBOL. (That way the faust definition, which does not use !, don't override it`. Would there have been a better/cleaner way?)

A file detector would indeed be nice!
Most copybooks would start with several comment lines (1+), but those may look different depending on the dialect.

Side-note: "common" COBOL file types also include "pco" for Oracle Pro*COBOL and "sqb" for the DB2 preprocessor.
Rarely used but also seen: copy (and of course: all of the extensions in upper-case as well).

Has anyone contacted Ankit Jain and got a response (the syntax files are kinda outdated)?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c3293913256@github.com>

Blake North

unread,
Sep 15, 2025, 5:07:14 PM (2 days ago) Sep 15
to vim/vim, Subscribed
PowerUser64 left a comment (vim/vim#14894)

Good to know. Based on research, do you think searching for these words in the first 10 or so lines would detect most cobol files?

  • PERFORM
  • PROCEDURE
  • ^[*] (regex)

I've never seen a cobol .lib file before, so I don't know what I would expect to find in one. Feel to adjust.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c3293953305@github.com>

Simon Sobisch

unread,
Sep 15, 2025, 6:38:22 PM (2 days ago) Sep 15
to vim/vim, Subscribed
GitMensch left a comment (vim/vim#14894)

PROCEDURE would be less likely (there's only one place where you can use it), I'd drop that. DIVISION. is similar (so I'd also not use that). They are likely to be found in COBOL programs, but we search for copybooks only (kind of #include, just with a possible complex text replacement (not positional like macros but leading/trailing/complete words).

For comments: the * at column 7 (standard, no matter what's in col 1-6) or column 1 (extension); less likely is *> (free format - if this is used as "complete line" comment (that's what we look for) it is prefixed by 0 to 11 spaces (I guess that's^[ }+[*]>).
For copybooks you will commonly see SECTION. (non-regex), that's a good thing to add.
For "code" included there: PERFORM ... may be in, but IF and MOVE are much more likely.
For "declarations": it is likely best to search for PIC, PICTURE, USAGE. COMP[ -.] VALUE (anywhere in the line), other parts are position-dependent or "too common" (USAGE and VALUE may apply there, too, not sure).

For all of those words above: case-insensitive is important.

For some "modern style" copybooks you can have a look at
https://github.com/meyfa/CobolCraft/blob/main/src/_copybooks/state/DD-SERVER-PROPERTIES.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cobjapi/AWT/src_cobol/cobjapifn.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cobjapi/AWT/src_cobol/cobjapi.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/worldcities/checkfilestatus.cpy
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/htm2cob/source/htm2cob8.cpy

Old style:
https://github.com/mridoni/gixsql/blob/main/copy/SQLCA.cpy
https://github.com/bmTas/JRecord/blob/master/examples/Cbl2Csv/src/test/resources/net/sf/JRecord/zData/DTAR020.cbl
https://github.com/Martinfx/Cobol/blob/master/AS400/QCBLLESRC/DUMP_FULL.CBLLE


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14894/c3294207263@github.com>

Reply all
Reply to author
Forward
0 new messages