Giter VIP home page Giter VIP logo

ocamlpro / superbol-studio-oss Goto Github PK

View Code? Open in Web Editor NEW
20.0 7.0 11.0 23.07 MB

Open-Source part of SuperBOL Studio, including the Visual Studio Code extension and its LSP server

Home Page: https://superbol.eu

License: Other

Makefile 0.27% Shell 0.18% OCaml 78.19% JavaScript 0.04% Python 0.17% Emacs Lisp 2.29% SourcePawn 0.22% COBOL 14.79% HTML 3.85%
cobol emacs-mode lsp-server vscode-extension

superbol-studio-oss's Introduction

SuperBOL Studio OSS: A New Platform for COBOL

Actions Status Release Tag

Visual Studio Code extension for COBOL.

Getting started

Installation

You can install SuperBOL Studio OSS either directly from within VS Code, or via a VSIX file.

Installation within VS Code

First, click on the "Extensions" icon in the activity bar on the left-hand side, or press Ctrl+Shift+X. Then, type "superbol" into the search bar to find it, and press its Install button.

You can find further instructions for installing extensions directly within VS Code on this page.

Installation via a VSIX file

First, download a VSIX file from the Marketplace or Open VSX.

To install the extension from its VSIX file, open VS Code and go to the the "Extensions" view. In the sidebar, click on the three dots (⋅⋅⋅) on the top right-hand side (just above search), select Install from VSIX…. Pick the VSIX file you just downloaded to install it.

Editing an existing project

To start using the extension on an existing project, open its folder in VS Code (File > Add Folder to Workspace…). The extension will start automatically whenever the folder contains files with usual COBOL filename extensions (.cob, .cbl, .cpy, .cbx).

Then, open the settings (File > Preferences > Settings, or Ctrl+,), and start typing "superbol…". You will be presented with a screen that resembles:

SuperBOL settings

From here, you can notably configure:

  • The COBOL dialect used in the project (see here for a documentation on every available dialect). In SuperBOL, the default dialect corresponds to GnuCOBOL's default, that supports many features from dialects such as COBOL2014, IBM, Micro Focus (mf), or GCOS for instance;

  • The default reference source-format (see here for a documentation on the supported source formats). When auto is selected, which is the default, SuperBOL (and GnuCOBOL) will automagically try to guess whether the source is in free or fixed format. Other source formats need to be configured explicitly.

  • The path to copybooks. To configure this setting, you will need to select Edit in settings.json. This is a list, where each entry describes an element of the search path where your copybooks will be looked for. Each entry must contain a directory name dir, and may feature an optional file-relative flag. When absent or set to false, the latter field indicates that the directory name is either absolute, or relative to the root of the project's directory. When file-relative is true, the element of the search path is considered relative to the directory where each main source program is located.

    Editing copybook paths in .vscode/settings.json

Syntax diagnostics

Note

Syntax checks performed by SuperBOL Studio currently cover the COBOL85 dialect, and some constructions of more recent dialects supported by GnuCOBOL. Reporting of such diagnostics is currently disabled for dialects other than COBOL85 to avoid misleading developers with false diagnostics about syntax errors.

Reporting can be re-enabled for every dialect by setting the Force Syntax Diagnostics flag in SuperBOL configuration settings.

IntelliSense (auto-completion)

When editing a program, you can press Ctrl+Space to obtain suggestions on valid keywords, user-defined words (data item or paragraph names), and even complete COBOL sentences. Select an option with the arrow keys, and press Enter to insert the selected suggestion.

IntelliSense sentence IntelliSense data item IntelliSense paragraph

Note

(Temporary limitation)

Suggestions of user-defined words may not comprise symbols that are defined in some sections of the data division.

Navigation features

Outline & Breadcrumbs

SuperBOL provides an outline view of your program once you open it, that you can use to navigate to specific sections or symbols (data items, paragraphs, etc). The same information is also shown in the "breadcrumbs" bar, that is usually located above the text edition area.

Outline & Breadcrumb

Go to Symbol

Symbols shown in Outline and Breadcrumbs views can also be searched and jumped to by pressing Ctrl+Shift+O.

Go to Symbol

Go to Definition

When you want to locate the definition of a data item name in your source code, position your cursor on its name, right click, and select  Go to Definition (or press F12).

Go to Definition

Peek Definition

To only have a peek at where such a data item defined, you can position the cursor on its name, right click, and select  Peek > Peek Definition (or press Ctrl+Shift+F10). You will then be presented with a view of the location of the corresponding definition, including if it lies in a copybook.

Peek Definition in copybook

Go to References

If you want to obtain a list of all references to a named data item, right click and select  Go to References (or press Shift+F12). You will then view the location of every reference to this item.

Go to References

Note

(Temporary limitation)

At the moment, definitions that belong to some sections of the data division, and some references to data items, are ignored by the extension. They will be covered by the first stable release.

Hover to Show Copybooks

Ever wondered what was behind a COPY directive? Just position your cursor over such a statement, and you will be presented with the contents of the copybook.

Hover over COPY

Hover to Show Source Text Replacements

What's more? You can see the source text that results from replacement by a REPLACE directive in the same way.

Hover over replacement

Debugging

In order to debug a COBOL program, you first need to run a build task with appropriate debug options. Once this is done, you can launch the compiled program in a debugging session.

Note

We recommend that a version of GnuCOBOL that is at least as recent as version 3.2 be available on the system running VS Code. Debug and coverage features respectively assume that gdb and gcov are installed.

On Windows systems, users may employ dedicated installers that are available here. Linux users may rely on their favorite package manager and install gnucobol.

Running a Build Task for Debugging

After having opened the program to debug, select Terminal > Run Build Task… (Ctrl+Shift+B), and then SuperBOL: build (debug).

Select SuperBOL: build (debug)

Launching the Compiled Program for Debugging

If needed, you can place a breakpoint on statements (or paragraph titles in the procedure division) by clicking on the red dot that appears when you hover the cursor on the left margin (or with F9). Click on the red dot or press F9 again to remove a breakpoint. Then, to launch the program in debug mode, select Run > Start Debugging (F5). This will run your program until a first breakpoint if reached, or to completion.

Start Debugging

Once stopped on a breakpoint, you can investigate the values of data items from the program using the VARIABLES panel on the left-hand side.

Press F10 to step to the next statement, or F5 again to continue until the next breakpoint, or termination of the program.

Customizing Build Tasks

To customize a build task, you can select Terminal > Configure Default Build Task…, and then SuperBOL: build or SuperBOL: build (debug) (the latter being the task that is run whenever you start a debugging session, e.g with F5).

Save the tasks.json as shown. Definitions for this task notably include a for-debug flag, that instructs the compiler to insert debug annotations into generated executable files, as well as extra-args, that can be edited to pass additional arguments to the cobc compiler.

tasks.json for debug

Coverage

GnuCOBOL can instrument your programs so they can generate coverage information at runtime. To enable this feature, you can set the for-coverage setting to true in the Superbol: build (debug) task in your tasks.json file (see Section Customizing Build Tasks).

Coverage Information

Generated coverage files are in gcov format; they are portable, and you can use them as you would any other coverage file generated for programs written using other programming languages.

Highlighting Coverage Information

Coverage data can be shown after the execution of a program that was compiled to generate this information terminates. SuperBOL will display coverage on a line-by-line basis, by highlighting the lines of your source code using colors that represent their coverage status. To enable coverage highlighting, you can open the command palette (or type Ctrl+Shift+P), and select SuperBOL: Show Coverage. You can also hide the highlighting with the command SuperBOL: Hide Coverage, and update it after re-executing your program with SuperBOL: Update Coverage.

Miscellaneous

Collaborating with other developers

At this point, the settings for your project are stored and managed by VS Code. However, you may plan to collaborate with developers that do not use this editor. For instance, they might want to use our mode for GNU/Emacs, which is located here. Then, we advise you to let SuperBOL Studio store the configuration in a superbol.toml file that will be located at the root of the project.

You can make the extension write your current project configuration into a superbol.toml by entering the command palette (View > Command Palette…, or press Ctrl+Shift+P), and then selecting the command SuperBOL: Write Project Configuration.

SuperBOL: Write Project Configuration

This will save a superbol.toml file at the root of each currently opened project directory. Such a file will not store any user-specific settings, so you can now safely put them under source control. Extensions dedicated to the edition of TOML files, such as tamasfe.even-better-toml, provide the same level of assistance as when you edit .vscode/settings.json.

Tip

Install the OCamlPro.SuperBOL-studio-pack extension to get SuperBOL Studio OSS and tamasfe.even-better-toml altogether.

Editing superbol.toml

Further documentation

You can check further the documentation on using the extension on this page.

Mode for GNU/Emacs

You can find here a mode that allows you to use the SuperBOL LSP server with GNU/Emacs.

Using the SuperBOL LSP server with other editors

This page documents how to use our LSP server functionnality with other editors.

Building from sources

If you build from a clone of the git repository, make sure to update submodules:

git submodule update --init --recursive

You first need to install a few external dependencies to build the LSP server and the VSCode extension from sources.

  1. First, you need to install and initialize opam;

  2. Then you need a recent version1 of our build tool drom. The easiest way to have it running is via the following command:

    opam pin add https://github.com/OCamlPro/drom.git
  3. Install node.js (version >=5.2.0) if it is not already installed.

  4. You can then install all remaining dependencies, and compile the LSP server along with the VS Code extension:

    make build-deps vsix-release

Resources

Footnotes

  1. Current version is 0.9.2~dev3 (commit 63a5770).

superbol-studio-oss's People

Contributors

bclement-ocp avatar ddeclerck avatar emilienlemaire avatar engboris avatar lefessan avatar lilyolivier avatar nberth avatar neokaios avatar stevendeo avatar weituodai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

superbol-studio-oss's Issues

FR: distribute the language-server along with the .vsix

A slightly longer plan might be to ship the binary within the vsix extension file.

Originally posted by @nberth in #75 (comment)

This issue is about doing so, using platform-specific extensions.

More details are found at https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions and of course - for the client side - https://github.com/microsoft/vscode-vsce.

There would be one version for each "target" you want plus one extra without a target (which would need an external install and possibly configuration to reach it as it is now).

Indenter: respect FormattingOptions

When formatting a document there are many FormattingOptions that can be specified, and are currently ignored by the indenter.

We should support these (at least tabSize, and possibly insertSpaces, seem relevant — not sure if the ones related to whitespace and newline trimming must be supported or are handled by a separate text formatter).

REDEFINES keyword in LSP: problem with case sensitivity?

In several worldcities files such as worldcities3.cbl and worldcities4.cbl, there are identical errors on REDEFINES statements in WORKING-STORAGE SECTION. It seems to be related to case sensitivity.

For example, when using the VSCode extension for worldcities3.cbl line 150-153:

01  filler redefines continents.
    03  filler occurs 7.
        05  continent-name pic x(16).
        05  continent-code pic xx.

continents is highlighted in red with the following error message:

Unexpected target name 'continents' in REDEFINES clause for FILLER item; expected 'CONTINENTS'

Another example with worldcities4.cbl line 135-153:

01  start-edge redefines polygon.
    03  filler occurs 5.
        05  start-city-name pic x(32).
        05  start-latitude pic s9(3)v9(6).
        05  start-longitude pic s9(3)v9(6).
    03  filler.
        05  filler pic x(32).
        05  filler pic s9(3)v9(6).
        05  filler pic s9(3)v9(6). 
 
01  end-edge redefines polygon.
    03  filler.
        05  filler pic x(32).
        05  filler pic s9(3)v9(6).
        05  filler pic s9(3)v9(6). 
    03  filler occurs 5.
        05  end-city pic x(32).
        05  end-latitude pic s9(3)v9(6).
        05  end-longitude pic s9(3)v9(6).

with error:

Unexpected target name 'polygon' in REDEFINES clause for item 'start-edge'; expected 'POLYGON'

debugging extension runs npm compile which fails

 *  Executing task: npm run compile 

> [email protected] compile
> make compile

make: *** No rule to make target 'compile'.  Stop.

 *  The terminal process "/bin/bash '-c', 'npm run compile'" terminated with exit code: 2. 
 *  Terminal will be reused by tasks, press any key to close it. 

Improve completion

Currently, the LSP does not help for completion of words:

  • First version: add keyword context-free completion
  • Second version: add context sensitive completion (i.e. depending on the location)

Minor issue in RST generation with `command_texi2rst.ml`

If I understand correctly, the program in src/lsp/superbol_free_lib/command_texi2rst.ml generates the sphinx/commands.rst file. It is a minor issue but the generated file generate warnings because it does not perfectly follow the Sphinx syntax:

superbol-studio-oss/sphinx/commands.rst:115: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:177: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:180: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:183: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:186: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:258: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:300: WARNING: Bullet list ends without a blank line; unexpected unindent.
superbol-studio-oss/sphinx/commands.rst:327: WARNING: Inline emphasis start-string without end-string.
superbol-studio-oss/sphinx/commands.rst:329: WARNING: Inline emphasis start-string without end-string.
superbol-studio-oss/sphinx/commands.rst:333: WARNING: Inline emphasis start-string without end-string.
[...]

It seems to me caused by misplaced * symbols, wrong indentation and such.

Error at installation

After installing superbol in /usr/local/bin and adding the extension from the vsix file, I get the following error in VSC:

[Error - 11:12:04] Cobol Server client: couldn't create connection to server.
Error: Unsupported server configuration {
    "command": "",
    "args": [
        "lsp"
    ]
}
	at MYHOME/.vscode/extensions/ocamlpro.superbol-0.1.0/_dist/superbol_vscode_platform.bc.js:18089:33

debug extension out of date

as https://github.com/OCamlPro/superbol-vscode-debug has no issue tracker, I'm posting it here

additional (as this isn't tracked) the "TODO: add screenshots" should be handled somedayTM

and one note: I highly suggest to move the code-coverage part out of the extension (it likely would be language agnostic, no?) or, if it cannot do "more" than the existing ones after the creation part is mainly a build task, may consider to drop that in favor of an (optional?) dependency on one of the existing coverage extensions.
Language agnostic will also have the benefit that it can be used for mixed-language coverage (GnuCOBOL modules CALLing into C modules and for GC devs possibly also into libcob).

Handle debugging-mode floating indicator (`>>D`)

In the GnuCOBOL doc, a -fdebugging-line option is defined for debugging. The D indicator (in the 7th column) is recognised by the LSP but not the >>D directive (which exists both in fixed and free format but according to GnuCOBOL sources it is strictly limited to COB2002 for free format). Such directives appear in the GnuCOBOL test suite.

I see that in the preprocessor's parsing of compiler directives, we parse expressions beginning by >>, followed by an optional space and finishing by some words used for compiler directives. However, >>D is different as it cannot have a space character in-between. For the fixed format, I thought about adding a case:

and fixed_cdir_line marker state          (* `>>`-prefixed compiler directive *)
  = parse
  | 'D'
      {
        fixed_debug_line state lexbuf
      }
  | ' '? cdir_word_suffix
      {
        Src_lexing.cdir_word ~ktkd:gobble_line ~knom:fixed_nominal
          ~marker (Src_lexing.flush_continued state) lexbuf
      }
  | epsilon
      {
        newline_or_eof (Src_lexing.flush_continued state) lexbuf
      }

But it would probably be a too ad-hoc fix.

syntaxes/COBOL.tmLanguage.json

Please note, this this grammar is not for the GnuCOBOL dialect but is for Micro Focus/OpenText based compilers.

It includes many reserved words that are not appropriate for GnuCOBOL and will cause inconsistencies with the lsp.

Generalize `goto-definitions` and `find-references`

Extend the current support for definitions in WORKING-STORAGE to other sections of the DATA DIVISION.

Achieving this requires:

  • Some preliminary refactoring and simplification of the parse-tree definitions (to be moved into a new cobol_ptree library);
  • Rework of cobol_data and cobol_typeck;
  • Maybe some minor adaptations in cobol_lsp.

superbol-free-linux-x64: version GLIBC_2.28 / GLIBC_2.35 not found

First test on the extension, did not work. Reason is seen in the language server output pane:

Testing with CentOS7

extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64: /usr/lib64/libm.so.6: version `GLIBC_2.29' not found (required by extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64)
extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64: /usr/lib64/libm.so.6: version `GLIBC_2.35' not found (required by extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64: /usr/lib64/libc.so.6: version `GLIBC_2.34' not found (required by extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64)
extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64: /usr/lib64/libc.so.6: version `GLIBC_2.28' not found (required by extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64)

Testing with RockyLinux 9.2:

extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64: /usr/lib64/libm.so.6: version `GLIBC_2.35' not found (required by extensions/ocamlpro.superbol-0.1.0/_dist/superbol-free-linux-x64)

Testing with Debian:

extensions/ocamlpro.superbol-0.1.0-linux-x64/_dist/superbol-free-linux-x64: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by extensions/ocamlpro.superbol-0.1.0-linux-x64/_dist/superbol-free-linux-x64)
extensions/ocamlpro.superbol-0.1.0-linux-x64/_dist/superbol-free-linux-x64: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by extensions/ocamlpro.superbol-0.1.0-linux-x64/_dist/superbol-free-linux-x64)

Can you create the distributed binary (CI?) on a CentOS7 environment? This seems to be compatible to nearly all environments in use.

Incorrect folding

I tested all worldcities files (which are written in free format) on Visual Studio Code Version 1.85.2. Here are several common errors related to folding:

  1. identification division folds the whole source code except for worldcities5 and worldcities6 (but I assume it is because of syntax errors). In all cases, it goes far beyond the identification division;
  2. for the file section in data division, the fold button appears at the wrong position, one line after (on the next fd sentence, typically);
  3. same thing for working-storage section, the fold button appears at the next definition when there're at least two definitions but it does not appear at all for a single declaration;
  4. in worldcities0.cbl L83-92:
working-storage section.

01  command-file-name pic x(128) value 'worldcities0.sh'.
01  techtonics.
    03  pic x(128) value 'export FILES=$HOME/worldcityfiles'.
    03  pic x(128) value
        'cobc worldcities0.cbl -x -W -fdebugging-line'.
    03  pic x(128) value './worldcities0 $FILES/CA.txt'.
    03  pic x(128) value 'rm worldcities0'.
    03  pic x(128) value 'end'.

it looks like the continuation line 'cobc worldcities0.cbl -x -W -fdebugging-line'. (L89) is mistakenly taken for a sub-level variable, making a fold button appear at the 03 pic x(128) value just before (L88). This happens for continuations lines in general;

  1. it may be related but in worldcities5.cbl L161:
           03  run-line.
               05  display-count pic z,zzz,zzzb.
               05  display-elapsed-seconds
                   redefines display-count pic zz,zz9.99b.
               05  display-message pic x(62).

there is a fold button on run-line, as expected and on display-elapsed-seconds as explained in the last point but also on display-count which folds redefines display-count pic zz,zz9.99b..

Remark

In case of "conflicts" between fold positions, there is a sudden increase of CPU usage. For instance, in the following code:

working-storage section.

01  command-file-name pic x(128) value 'worldcities0.sh'.
01  techtonics.
    03  pic x(128) value 'export FILES=$HOME/worldcityfiles'.
    03  pic x(128) value
        'cobc worldcities0.cbl -x -W -fdebugging-line'.
    03  pic x(128) value './worldcities0 $FILES/CA.txt'.
    03  pic x(128) value 'rm worldcities0'.
    03  pic x(128) value 'end'.

The fold button for working-storage section. (mistakenly) appears at 01 command-file-name pic x(128) value 'worldcities0.sh'. (L85) but if we define sub-levels for command-file-name:

working-storage section.

01  command-file-name pic x(128) value 'worldcities0.sh'.
    03  ...
    03  ...
    03  ...
01  techtonics.
    03  pic x(128) value 'export FILES=$HOME/worldcityfiles'.
    03  pic x(128) value
        'cobc worldcities0.cbl -x -W -fdebugging-line'.
    03  pic x(128) value './worldcities0 $FILES/CA.txt'.
    03  pic x(128) value 'rm worldcities0'.
    03  pic x(128) value 'end'.

Then a fold button should have also appeared for it, being in conflict with the former one. But such conflicts should not happen anyway and I assume it should be solved by correcting folding.

Clarify and handle `CONSTANT`/`78`-level entries

the format for qualified names does not accept any literal in the position of the qualifiers (XX in the example)

... which is the reason for the error message. A qualification needs an identifier.
You may be able to improve that by postponing, in this case you can raise a better error message like

syntax error, unexpected constant name 'XX`, expecting qualification

But let's check what the standard says. We have 8.4.6 "scope of names" that specifies under "8.4.6.2.2 Scope of condition-names, constant-names, ..."

A constant-name [...] described with a GLOBAL clause is a global name. All data-names and screen-names subordinate to a global name are global names. A constant-name, data-name, [...} declared in a source element for an object definition, whether factory or instance, is a global name. [...]

When a condition-name, constant-name, data-name, [...] is not a global name, it is a local name.

The requirements governing the uniqueness of the names allocated by a single source element to be condition-names, constant-names, data-names, [...] are explained elsewhere in these specifications. (See 8.3.2.2, User-defined words.)

Which then specifies:

Within a source element, a given user-defined word may be used as only one type of user-defined word
with the following [...exception:] the same name may be used as any of the following types of user-defined words:

  • constant-name
  • data-name
  • property-name
  • record-key-name
  • record-name

... but as 13.10.4.1 specifies

[...] the effect of specifying constant-name-1 in other than this entry is as if literal-1 [... is] written where constant-name-1 is written

I don't think the rules are clear. I'll ask the working group by mail.
Side note: Wikipedia says that

Association Française de Normalisation [AFNOR ... is a] member body for France at the International Organization for Standardization (ISO).

It is not clear to me which of those sub-organizations, if any, takes care of programming languages. I suggest you check with them as they don't have someone in the working group and may also not commented on the last versions.
You may be able to volunteer for that and by this also get access to both the documents of the working group (which were sadly moved to a non-public area which can only be accessed by ISO accounts (also given out to international member bodies) and to the working group itself.

Originally posted by @GitMensch in #53 (comment)

exceptions on unsaved files

It seems the extension tries to do something on the file system, while the active editor should get the content from the editor window (= also handles unsaved changes).

The easiest way to reproduce:

  • [CTRL]+[N] to create a new editor, as expected it is set to "Plain Text"
  • manually change to COBOL
  • see errors
[Error - 20:24:27] Request textDocument/semanticTokens/full failed.
  Message: Caught exception: Not parsing copybook at untitled:Untitled-4
  Code: -32603 
[Error - 20:24:27] Request textDocument/foldingRange failed.
  Message: Caught exception: Not parsing copybook at untitled:Untitled-4
  Code: -32603 

handling of conditional compilation (and `EXEC SQL`)

This sample program was shared on the IBM extension:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TSTSQLCA.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  HOWMUCH PIC S9(9) COMP-5.
       >>define isDB2 as b'1'
       >>if isDB2
           exec sql include sqlca end-exec.
       >>end-if
       PROCEDURE DIVISION.
       MAIN.
           exec sql
             select count(*) into :HOWMUCH
             from SYSIBM.SYSDUMM1
           end-exec
           if SQLCODE not = 0 and SQLCODE not = +100
             display "Oups !"
           end-if
           .
       BYE.
           goback.

I'm "quite sure" that the LSP also has a problem here (it should error if the >>define line is removed, and pass otherwise (and of course, know that HOMMUCH is used within the SQL statement).

Planning: when (if at all) should the LSP at least parse NIST85 without errors?

NIST85 has a lot of obsolete stuff in, most important is the line continuation including word continuation.

Then it has things that some preparsers stumble over (but that is also commonly used "somehow" in production code): fixed format with "comment" text in line 1-6, 73+ and minor ones like comment paragraphs (AUTHOR and friends).

It also has a lot of special PICTURE clauses and strange formatted code.

As I don't know what the state is: Is the LSP already able to parser all of NIST85 without errors?

... and a special thing: can it handle the programs that GnuCOBOL compiles and executes in its testsuite?
For the later one may use autofonce and set COBC to a shell that first sends the LSP to those files (expecting no output) and afterwards cobc. ... and of course something similar may be done with the NIST85 autofonce'd version (or again by exporting COBC to a shell that executes both).

provide outline view

so far that is empty "no symbols found", but the LSP surely has information for that

Rigid order of paragraphs in configuration section

In the following program:

environment division.
configuration section.
repository. function all intrinsic. 
special-names. C01 is one-page.
input-output section.
file-control.

the keyword special-names produces an Invalid Syntax error with the VSCode extension. However, if we exchange the repository paragraph and the special-names one:

environment division.
configuration section.
special-names. C01 is one-page.
repository. function all intrinsic. 
input-output section.
file-control.

there is no error.

It seems to me that the LSP requires the special-names paragraph to occurs strictly after a repository paragraph. However, both are accepted by GnuCOBOL.

Documentation for alpha-release users

Documentation should explain:

  • the list of features of the extension
  • the known limitations of the extension:
    • no support for GnuCOBOL's comma-separated arguments to functions
  • how to install it from binary
  • how to install it from sources
  • how to use most common features

hard dependency on tamasfe.even-better-toml

As far as I see that's for better supporting the superbol configuration - Could this extension be "suggested" only instead of the hard dependency? vscode declined to install the superbol extension because the toml one was not installed.

bug: words are "recognized" with the default "C style"

While the COBOL word recognition was added to the debugging part (registerEvaluatableExpressionProvider) it is missing in the plain editor. I don't know if this is about the tm syntax or an lsp part, but if I put the cursor into SOME-VAR, then the complete word should be highlighted, not only the part before/after the hyphen.

recognize `WITH DEBUGGING MODE`

While I consider that a low-priority issue, this just occurred to me as a cool feature which may be relative easy to implement in the language server:

  • If debugging mode is not active:
    • mark lines with debugging indicator as comment lines (currently always done)
    • mark "use for debugging" sections as comment lines (currently never done)
  • if it isn't: swap around

Maybe there's a way to mark them different to a comment, ideally like #ifdef 0 parts in C?

Currently, that mode would only be active depending on the DEBUGGING MODE phrase of the SOURCE-COMPUTER paragraph

Move file indentation out of `Cobol_indent`

          Now that I think about it, the code for effectively indenting a file should just not belong to `cobol_indent`; there, we should just stick to the indentation logic/algorithm. By that approach, `Superbol_free_lib` may just rely on `lsp` to apply the text editions.

(Apologies if there was an indent_file function already there; it should have been removed before).

Originally posted by @nberth in #97 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.