Git Product home page Git Product logo

ada_language_server's Introduction

Ada Language Server

Build binaries GitHub tag (latest by date) VS Marketplace Open VSX Registry Gitpod ready-to-code

This repository contains an implementation of the Microsoft Language Server Protocol for Ada/SPARK and GPR project files.

Current features (general):

For Ada/SPARK, we provide the following:

  • Code completion for names, keywords, aggregates, etc.
  • Code navigation, such as Go to Definition/Declaration, Find All References, Call Hierarchies, etc.
  • Code refactoring like insert named associations, auto-add with-clauses, etc.
  • Document/Workspace symbol search.
  • Code folding and formatting.

The Ada Language Server now also supports the GPR language, via the --language-gpr option, providing support for the most used LSP features such as navigation, outline and tooltips for GPR files. When this switch is present, the server will only support GPR files. To support both GPR and Ada/SPARK, you'll need to launch two instances of the server. You can refer to the Supported LSP Server Requests section for more information.

We also provide Visual Studio Code extension at the VS Marketplace and at the Open VSX Registry.

Table of Contents

Install

You can build language server from sources. To build it from sources install dependencies and run

make

It will build .obj/server/ada_language_server file.

Dependencies

To build the language server you need:

Project files of the libraries must be available via the GPR_PROJECT_PATH environment variable.

If you intend to use VS Code on this workspace, it is recommended to check out these dependencies under subprojects/ or install them under subprojects/prefix. That will make them automatically visible to the VS Code Ada extension in this workspace.

To run the language server you need gnatls (part of GNAT installation) somewhere in the path.

Usage

The ada_language_server doesn't require any command line options, but it understands these options:

  • --tracefile=<FILE> - Full path to a file containing traces configuration
  • --config=<FILE> - Full path to a JSON file containing the server's configuration
  • --help - Display supported command like options and exit.

You can turn some debugging and experimental features through the traces file.

The server also gets configuration via workspace/didChangeConfiguration notification and initializationOptions of initialize request. See more details here. Each LSP client provides its-own way to set such settings. You can use the --config option if you want to provide the configuration directly via a JSON file instead of specifying it via the requests listed just above.

Memory Consumption

The ada_language_server relies on Libadalang to compute the cross references. Most of this computation is done while indexing which will create an internal cache. The expected memory size of this cache is around 300Mb per 100k lines of Ada code. Furthermore, 450Mb are necessary for the runtime. Please note that some Ada structures like generics and tagged types might increase the memory usage. This is also the case when using aggregate projects. These measures were taken using both Resident Set Size and Valgrind massif on Ubuntu 22.04LTS.

Supported LSP Server Requests

See WiKi page for the list of supported requests.

Protocol Extensions

The Ada Language Server supports some features that are not in the official Language Server Protocol specification. See corresponding document.

VS Code Extension

A VS Code extension based on this Ada Language Server is available on the Visual Studio Marketplace. It provides a full set of features including syntax highlighting, navigation, building and debugging.

Getting Started

Here are some links that will help you get familiar with the VS Code extension for Ada & SPARK:

Configuration

You can configure the extension via the .vscode/settings.json workspace settings file or the multi-root workspace file. See the setting list here.

Here is an example config file:

{
   "ada.projectFile": "gnatcov.gpr",
   "ada.scenarioVariables": {
      "BINUTILS_BUILD_DIR": "/null",
      "BINUTILS_SRC_DIR": "/null"
   },
   "ada.defaultCharset": "utf-8",
   "ada.enableDiagnostics": false,
   "ada.renameInComments": false
}

Refactoring

See a dedicated document with the list of available refactorings.

Tasks

The extension provides the following auto-detected tasks (under /Terminal/Run Task... menu):

  • ada: Build current project - launch gprbuild to build the current GPR project
  • ada: Check current file - launch gprbuild to check errors in the current editor
  • ada: Clean current project - launch gprclean to clean the current GPR project
  • spark: Examine project - launch gnatprove in flow analysis mode on the current GPR project
  • spark: Examine file - launch gnatprove in flow analysis mode on the file in the current editor
  • spark: Examine subprogram - launch gnatprove in flow analysis mode on the current subprogram in the current editor
  • spark: Prove project - launch gnatprove on the current GPR project
  • spark: Prove file - launch gnatprove on the file in the current editor
  • spark: Prove subprogram - launch gnatprove on the current subprogram in the current editor
  • spark: Prove selected region - launch gnatprove on the selected region in the current editor
  • spark: Prove line - launch gnatprove on the cursor line in the current editor
  • spark: Clean project for proof - launch gnatprove on the current GPR project to clean proof artefacts
  • ada: Analyze the project with GNAT SAS
  • ada: Analyze the current file with GNAT SAS
  • ada: Create a report after a GNAT SAS analysis
  • ada: Analyze the project with GNAT SAS and produce a report

You can bind keyboard shortcuts to them by adding to the keybindings.json file:

{
  "key": "alt+v",
  "command": "workbench.action.tasks.runTask",
  "args": "ada: Check current file",
  "when": "editorLangId == ada"
}

Task Customization

You can customize auto-detected tasks by providing extra tool command line options via the args property of the object in the tasks.json:

{
   "version": "2.0.0",
   "tasks": [
      {
         "type": "ada",
         "command": "gprbuild",
         "args": [
            "${command:ada.gprProjectArgs}",
            "-cargs:ada",
            "-gnatef",
            "-gargs",
            "-vh"
         ],
         "problemMatcher": ["$ada"],
         "group": "build",
         "label": "ada: Build current project"
      }
   ]
}

You can also customize the working directory of the task or the environment variables via the options property:

{
   "version": "2.0.0",
   "tasks": [
      {
         "type": "ada",
         "command": "gprbuild",
         "args": [
            "${command:ada.gprProjectArgs}",
            "-cargs:ada",
            "-gnatef"
         ],
         "options": {
            "cwd": "${workspaceFolder}/my/subdir",
            "env": {
               "MY_ENV_VAR": "value"
            }
         },
         "problemMatcher": ["$ada"],
         "group": "build",
         "label": "ada: Build current project"
      }
   ]
}

Tasks for Project Mains

If your GPR project defines main programs via the project attribute Main, additional tasks are automatically provided for each defined main. For example, if the project defines a main1.adb and main2.adb located under the src/ source directory, the following tasks will be available:

  • ada: Build main - src/main1.adb
  • ada: Run main - src/main1.adb
  • ada: Build and run main - src/main1.adb
  • ada: Build main - src/main2.adb
  • ada: Run main - src/main2.adb
  • ada: Build and run main - src/main2.adb

GNATtest Support

If you install GNATtest, the Ada & SPARK extension for VS Code will provide the following functionalities:

  • The task ada: Create/update test skeletons for the project will call gnattest to create test skeletons for your project automatically. You can use standard VS Code task customization to configure command line arguments to your liking in a tasks.json file.

  • Tests created with GNATtest will be loaded in the VS Code Testing view as follows.

    GNATtest Test Tree
  • Tests can be executed individually or in batch through the available buttons in the interface, or through the Test: Run All Tests command or related commands.

  • Test execution results are reflected in the test tree.

    GNATtest Test Results

GNATtest support has the following known limitations:

  • The extension relies on the default conventions of GNATtest such as the naming, location and object directory of the test harness project. If those aspects are configured or altered manually, the features may no longer work.

  • Test execution always starts with a gprbuild call on the test harness project. It is not possible to disable that call or customize its arguments. This limitation will be lifted in future releases.

  • Language support such as navigation and auto-completion is limited when editing test sources. A workaround is to modify the ada.projectFile setting to point to the test harness project created by GNATtest. That should restore language support when developing tests.

  • Sections of test sources delimited by begin read only and end read only comments are not really protected from inadvertant edits. To ensure proper interactions with GNATtest, you must refrain from making edits in those sections.

ALIRE Support

When the workspace is an ALIRE project (i.e. it contains an alire.toml file), tasks automatically use standard ALIRE commands.

For example, the ada: Build current project task uses the command alr build and the ada: Clean current project task uses the command alr clean.

All other tasks use alr exec -- ... to execute the command in the environment provided by ALIRE.

Commands and Shortcuts

The extension contributes commands and a few default key bindings. Below are a few examples, and other commands can be found by searching for Ada: in the command list.

Ada: Go to other file

This command switches between specification and implementation Ada files. The default shortcut is Alt+O.

Ada: Add subprogram box

This command inserts a comment box before the current subprogram body. The default shortcut is Alt+Shift+B.

Ada: Reload project

This command reloads the current project. The default shortcut is None.

Tasks with keyboard shortcuts

The following default shortcuts are provided for tasks:

Task Shortcut
spark: Prove file Meta+Y Meta+F
spark: Prove subprogram Meta+Y Meta+S
spark: Prove selected region Meta+Y Meta+R
spark: Prove line Meta+Y Meta+L

Meta = ⌘ on macOS, Win on Windows, Meta on Linux

These shortcuts can be customized and new shortcuts can be added for other tasks by using the command Preferences: Open Keyboard Shortcuts (JSON) and adding entries like the following example:

{
    "command": "workbench.action.tasks.runTask",
    "args": "ada: Check current file",
    "key": "meta+y meta+c",
    "when": "editorLangId == ada && editorTextFocus"
}

Bug Reporting

You can use the VS Code Issue Reporter to report issues. Just click on the Help -> Report Issue menu, select An extension for the File on entry and Language Support for Ada for the extension name. Put as many information you can in the description, like steps to reproduce, stacktraces or system information (VS Code automatically includes it by default). This will create a GitHub issue in the Ada Language Server repository.

ALS log files can be found under the ~/.als directory (%USERPROFILE%/.als on Windows). Feel free to attach them on the issues, it helps a lot for further investigation, specially when the ALS.IN and ALS.OUT traces are enabled (more info about traces configuration can be found here.)

Limitations and Differences with GNAT Studio

The VS Code extension has a few limitations and some differences compared to GNAT Studio:

  • Indentation/formatting: it does not support automatic indentation when adding a newline and range/document formatting might no succeed on incomplete/illegal code.

  • Tooling support: we currently provide support for some SPARK, GNATtest and GNAT SAS Tasks, but there is no support for tools such as GNATcheck or GNATcoverage yet.

  • Alire support: if the root folder contains an alire.toml file and there is alr executable in the PATH, then the language server fetches the project's search path, environment variables and the project's file name from the crate description. Tasks are also automatically invoked with ALIRE in this case.

  • Project support: there is no Scenario view: users should configure scenarios via the ada.scenarioVariables setting (see the settings list available here). Saving the settings file after changing the values will automatically reload the project and update the predefined tasks to take into account the new scenario values.

    Source directories from imported projects should be added in a workspace file. If you already have a workspace file, the extension will propose you to automatically add all the source directories coming from imported projects to your workspace automatically at startup.

Integration with other editors and IDEs

Integration with Coc.NVim

If you want to use the Ada Language Server with Vim/Neovim, you can use the Coc.NVim. You'll have to install the Ada Language Server manually somewhere on your computer. Follow installation instructions on Coc.NVim website and then configure the Ada Language Server with :CocConfig:

{
  "languageserver": {
    "ada": {
      "settings": {
        "ada": {
          "projectFile": "gnat/vss_text.gpr"
        }
      },
      "command": "<path>/ada_language_server",
      "filetypes": [
        "ads",
        "adb",
        "ada"
      ]
    }
  }
}

Integration with vim-lsp

If you want to integrate the Ada Language Server into vim, you can use the vim-lsp.

You'll have to install the Ada Language Server manually somewhere on your computer, and then you can add the following line to your .vimrc file:

if executable('ada_language_server')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'ada_language_server',
        \ 'cmd': ['ada_language_server'],
        \ 'allowlist': ['ada'],
        \ 'workspace_config': {'ada': {
        \     'projectFile': "project.gpr",
        \     'scenarioVariables': {"ARCH": "x86_64-pc-linux-gnu"}}},
        \ })
endif

Integration with LanguageClient-Neovim

If you want to integrate the Ada Language Server into Neovim, you can use the LanguageClient-neovim.

You'll have to install the Ada Language Server manually somewhere on your computer, and then you can add the following line to your init.vim file:

" replace the path below with the proper path to the ada_language_server executable
let g:LanguageClient_serverCommands = {
    \ 'ada': ['path/to/ada_language_server'],
    \ }
" if you already have LanguageClient_serverCommands, just add a line for ada.

To configure the Ada Language Server for a specific workspace/project, you can use the .vim/settings.json file. It is mandatory as soon as you want to use a specific .gpr project file.

This is the way to specify a project file, eg. you cannot open a project file another way. See the setting list here.

Here is an example of a settings file:

{
    "ada.projectFile": "project.gpr",
    "ada.scenarioVariables": {
        "GLFW_Version": "3",
        "GLFW_Lib": "-lglfw",
        "Windowing_System": "x11"
    }
}

The location where the .vim folder is located will determine the relative path of the project file (so no need to prefix with ..). When vim is opened in the folder containing this .vim directory, it will use those settings for the language server even for files which might have nothing to do with that specific project, so this needs to be taken into account. Ultimately what this means is that the configuration is determined by where you open vim.

Integration with Neovim's built-in LSP client

Neovim 0.5.0 and later have a built-in LSP client which can be used with the Ada Language Server. In order to use it with minimal effort, follow these steps:

  • Install the ada language server and make sure it's in your $PATH.
  • Use your favorite Neovim plugin manager to add the default set of LSP configuration files to Neovim.
  • Enable the Ada Language Server by adding :lua require('lspconfig').als.setup{} to your init.vim.

If you would rather not have the ada language server in your path, you can give the lsp client an absolute path to the ALS executable:

require('lspconfig').als.setup{ cmd = "/path/to/als/executable" }

Configuring the language server's settings can be achieved like this:

require('nvim_lsp').als.setup{
  settings = {
    ada = {
      projectFile = "project.gpr";
      scenarioVariables = { ... };
    }
  }
}

The Ada Language Server's settings are described here. Configuring neovim to use project-specific settings is described neovim's lspconfig wiki

Integration with emacs lsp-mode

The configuration for each project can be provided using a .dir-locals.el file defined at the root of each project.

The scenario variables should be declared in your .emacs or any loaded Emacs configuration file.

(defgroup project-build nil
  "LSP options for Project"
  :group 'ada-mode)

(defcustom project-build-type "Debug"
  "Controls the type of build of a project.
   Default is Debug, other choices are Release and Coverage."
  :type '(choice
          (const "Debug")
          (const "Coverage")
          (const "Release"))
  :group 'project-build)

Your .dir-locals.el in the project root should be similar to:

((ada-mode .
  ((eval . (lsp-register-custom-settings
      '(("ada.scenarioVariables.BINUTILS_SRC_DIR" project-binutils-dir)
        ("ada.scenarioVariables.BUILD_TYPE" project-build-type "Release"))))
   (lsp-ada-project-file . "/home/username/project/project.gpr"))
  ))

The lsp-mode provides built-in support for the ada_language_server and defines default customizable configuration values in the lsp-ada group that can be edited similarly to lsp-ada-project-file in the example above.

Integration with QtCreator

Starting with version 4.9, QtCreator supports a LSP plugin. Follow the official documentation to configure the Ada Language Server in this plugin. Make sure to set Startup behavior to Start Server per Project, otherwise QtCreator won't provide the project root to the Ada Language Server. QtCreator doesn't send any configuration request to the language server, so the only option to enable project support is to have a single .gpr file in the QtCreator project folder. For a projectless configuration, you could also place all Ada sources in the project root folder, this should work as well.

Refactoring Tools

See corresponding document.

Authors & Contributors

  • Maintained by AdaCore.
  • Original author @MaximReznik.
  • Support for the Visual Studio Code classifier and snippets contributed by @Entomy.

Contribute

Feel free to dive in! Read the developer's guide.

Don't hesitate to open an issue or submit PRs.

License

GPL-3

ada_language_server's People

Contributors

abdellah257 avatar adrienboulanger avatar aerijo avatar anthonyleonardogracio avatar bracke avatar eliericha avatar entomy avatar enzbang avatar gcluzel avatar glacambre avatar godunko avatar joaopsazevedo avatar lambourg avatar leocreuse avatar leogermond avatar ogorodnik avatar pmderodat avatar ptroja avatar raja-s avatar raph-amiard avatar reznikmm avatar roldak avatar rowan-walshe avatar setton avatar simonjwright avatar thvnx avatar yakobowski avatar yannickmoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ada_language_server's Issues

Syntax highlighting of declare statement

In 21.0.13, I find the syntax highlight of the declare statement to be somewhat surprising:
image

I can imagine this was done on purpose, but felt it was worth asking: is the idea that, since declare introduces new identifiers, it should get the same syntax highlighting as a subprogram declaration/definition? That kinda makes sense to me, except that a for loop also introduces new identifiers, yet its syntax highlighting matches other control-flow statements. Of course, arguably, the declare statement is not about control flow, so ... I'm back to thinking this makes sense.

Nevertheless, having the highlighting color change mid-subprogram is a bit surprising to me.

Mixed syntax highlighting for compound keywords

In 21.0.13, there are some compound keywords that received mixed syntax highlighting. These are at least:

  • for all
  • for some
  • end loop
  • end if

Examples:
image
image

I suspect that this is related to #436, but wonder if it would be possible to modify the tokenizer to simply treat these as distinct tokens in the short term?

Alternatively, while I like the idea of having distinct colors for things like subprogram declarations, I'll note that this is not the default in GNAT Studio. Here's an example in GNAT Studio:
image

And the same example in VS Code:
image

Completion of procedure calls

When I use Intellisense to complete the name of a procedure in my code, all the arguments are added on the line. Maybe a screenshot can help to understand:
image
I think it would be better to only complete the name of the function without the parameters and open a help pop-up like it's done in other languages like Python as soon as the parenthesis is opened (screenshot below).
image
I have no idea about the complexity of this request, but I find how it's done now isn't very usual to me, and I guess it's something that can be done to improve user-experience.

Crashes on hovering over anything in the source file

Move the mouse over the source, in the output pane get:

[Error - 16:34:15] Request textDocument/documentSymbol failed.
  Message: CONSTRAINT_ERROR
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/libgnatcoll.so.0]
0x7fa97bfd9986 gnatcoll__projects__info_set at ???
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/ada_language_server]
Lsp.Ada_Contexts.Is_Part_Of_Project at lsp-ada_contexts.adb:241
Lsp.Ada_Handlers.Get_Best_Context_For_File at lsp-ada_handlers.adb:135
Lsp.Ada_Handlers.Get_Best_Context_For_Uri at lsp-ada_handlers.adb:157
Lsp.Ada_Handlers.Get_Document at lsp-ada_handlers.adb:170
Lsp.Ada_Handlers.On_Document_Symbols_Request at lsp-ada_handlers.adb:1297
Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:138
Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:841
Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:923
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/libgnarl-2019.so]
0x7fa97a0043f4 system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7fa9799883a5
[/lib64/libc.so.6]
0x7fa97988b89d
0xfffffffffffffffe

  Code: -32603 
[Error - 16:34:15] Request textDocument/hover failed.
  Message: CONSTRAINT_ERROR
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/libgnatcoll.so.0]
0x7fa97bfd9986 gnatcoll__projects__info_set at ???
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/ada_language_server]
Lsp.Ada_Contexts.Is_Part_Of_Project at lsp-ada_contexts.adb:241
Lsp.Ada_Handlers.Get_Best_Context_For_File at lsp-ada_handlers.adb:135
Lsp.Ada_Handlers.Get_Best_Context_For_Uri at lsp-ada_handlers.adb:157
Lsp.Ada_Handlers.On_Hover_Request at lsp-ada_handlers.adb:1025
Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:102
Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:841
Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:923
[/home/laguest/.vscode-insiders/extensions/adacore.ada-0.0.1/linux/libgnarl-2019.so]
0x7fa97a0043f4 system__tasking__stages__task_wrapper at ???
[/lib64/libpthread.so.0]
0x7fa9799883a5
[/lib64/libc.so.6]
0x7fa97988b89d
0xfffffffffffffffe

  Code: -32603 

Fedora Linux - Open file "Request has failed" every time

Whenever I open a file, this message pops up.

System: Fedora 32 Linux

Output window:

[Error - 7:10:58 PM] Request textDocument/documentSymbol failed.
Message: CONSTRAINT_ERROR
[.vscode/extensions/adacore.ada-22.0.1/linux/ada_language_server]
0xc88be3
0xc9e355
0xd625ed
0xd82fd6
0xd884e4
0xcb54d8
0xceb556
0xcea52d
[.vscode/extensions/adacore.ada-22.0.1/linux/libgnarl-2020.so]
0x7f883083a958
[/lib64/libpthread.so.0]
0x7f88301f7430
[/lib64/libc.so.6]
0x7f8830101911
0xfffffffffffffffe

Code: -32603
[Error - 7:10:58 PM] Request textDocument/foldingRange failed.
Message: CONSTRAINT_ERROR
[.vscode/extensions/adacore.ada-22.0.1/linux/ada_language_server]
0xc88be3
0xc9e355
0xd516e1
0xd7fbf3
0xd8824a
0xcba680
0xceb556
0xcea52d
[/home/ken/.vscode/extensions/adacore.ada-22.0.1/linux/libgnarl-2020.so]
0x7f883083a958
[/lib64/libpthread.so.0]
0x7f88301f7430
[/lib64/libc.so.6]
0x7f8830101911
0xfffffffffffffffe

Code: -32603

Support for alire

It would be really useful if, when you initialize a project which has a .alire directory adjacent to it, alr were called to get the correct project path set up so that everything works as expected. If this were built into ada_language_server, it would no longer be necessary to have an alr plugin in GnatStudio, and it would automatically extend to other clients using ada_language_server.

Move Vscode extension to another marketplace account

We are going to move ALS extension to our new corporative Marketplace account.

This issue is to make this more visible to the community.

The plan is

  1. Commit depreciation warnings in the master branch
  2. Issue new version in under old personal account
  3. Remove depreciation warnings from the master branch and fix marketplace token
  4. Issue new version in under new corporative account

Possible misclassification of certain keywords?

image

It seems like you've gone for a split classification approach of keywords, so that certain keywords are classified and highlighted as operators, some as regular keywords, and some as control keywords. I appreciate this because it allows certain themes to specifically highlight certain classifications.

However I am confused as to why what I would think are obvious controls, such as if and loop, are not classified as control keywords.

With VSCode, unable to make textDocument/references works, except on Standard Library !?

Hello
I am using Windows / VS Code 1.50.1 / extension LSA v22.0.1

Edit, compile and basic navigation works fine.
But "Find all references" (who call textDocument/references if I understood correctly) almost always returns No results

In the attached basic example:

For any internal and external procedures, no results :
[Trace - 16:43:24] Received response 'textDocument/references - (145)' in 1ms.
Result: []

For Ada. Text_IO.Put_Line, 4 results in 3 files
[Trace - 16:41:52] Received response 'textDocument/references - (140)' in 5ms.
Result: [
{
"uri": "file:///C%3A/Checkout-SVN/WS1/hello.adb",
"range": {
"start": {
"line": 9,
"character": 18

Did I miss - again - something ?

WS1.zip

Output window interrupting workflow

Hi Folks.
I am continually interrupted by the output window getting various errors. Is it possible to turn that off? Apologies for using an issue to essentially just ask a question, but I wasn't sure where else to post.

Can I post what I get? Sure, but it happens every 2-3 minutes at least, all kinds of different things. You can find the latest example at the end.
Can I post example source code that reproduces? Yes, if I wanted to I could, although -- I don't want to spend the extra effort on that if there's a way to stop it flashing the output window to the top all the time. I use the terminal windows for building and I don't like having to reselect the 'terminal' tab 100 times in an editing session. That is not an exaggeration.
I like the server, it does a fine job and gives me almost all I want. I don't want to disable it, but I'm getting close.

Thanks
Dan

`[Error - 10:05:27 AM] Request textDocument/codeAction failed.
Message: CONSTRAINT_ERROR
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libadalang\libadalang.dll]
0x1e033ae
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\ada_language_server.exe]
0xc90034
0xc906a3
0xc8e6fa
0xcb9b7b
0xcc305a
0xc19367
0xc57391
0xc563b5
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libgnarl-2020\libgnarl-2020.dll]
0x69894aaa
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffdcf4a7bd2
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffdd0e0ce4f

Code: -32603
[Error - 10:13:23 AM] Request textDocument/completion failed.
Message: PROGRAM_ERROR
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libgnat-2020\libgnat-2020.dll]
0x67504593
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffdd0e411cd
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffdd0e0a207
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffdd0e3fe3c
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libadalang\libadalang.dll]
0x1e773f3
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libadalang\libadalang.dll]
0x1e85c50
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libadalang\libadalang.dll]
0x1e8517c
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\ada_language_server.exe]
0xbdf12c
0xcb457d
0xcba1a3
0xcc30bc
0xc1a1e0
0xc57391
0xc563b5
[c:\Users\Dan.vscode\extensions\adacore.ada-21.0.14\win32\libgnarl-2020\libgnarl-2020.dll]
0x69894aaa
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffdcf4a7bd2
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffdd0e0ce4f

Code: -32603`

Missing syntax highlighting for certain keywords

In 21.0.13, there are a few keywords that receive no syntax highlighting at all. They are, at least:

  • of
  • in
  • not
  • and
  • or

Here's an example that captures most of these:
image

Note that in is also unhighlighted in other contexts (e.g., subprogram signatures):
image

Integration with QtCreator

Has anyone tried ALS on QtCreator's LSP client? I showed QtCreator where's ada_language_server but apparently nothing happens. Do I need to add .gpr files in order to make ALS work? I have a basic .adb file with a .pro file I made specifically for this tiny project.

Incorrect/incomplete highlighting of package names

image

I'm not sure what the intent was here. If the intent was to provide highlighting to all package names, then it doesn't work for the list-like include statements. Furthermore it seems to think the package name is actually a function, which makes me think the intent might not have been to highlight package names at all.

Add/populate READMEs

It would be good to have more comprehensive READMEs, that at least include getting started phases.

The Readme in the VSCode directory is still the template, and the toplevel README contains almost nothing.

Assigning to you max for a first pass, you can reassign after if you want

Incorrect classification for the types that are classified

I checked with Macromates documentation, since that's where the TextMate conventions were originally defined, and are ultimately what VS Code adheres to.

image

However the standard types are classified as support.type

image

Which is intended for framework/library types, rather than storage.type.

Many themes actually color these differently, albeit similarly.

Proposal for Collaboration

This is not something I have come to easily. However, it is something I beleive to overall be in the best interest for the community, and each other.

Let's cover hard facts and intended outcome first, and then my intentions after.

At the time this extension was formally announced and uploaded to the marketplace, there were already four Ada extensions in existence, at least that I'm aware of. Two of these were already on the marketplace, the oldest seeming to belong to Alessandro Del Sole, as well as my own. The other two that I'm aware of haven't been uploaded to the marketplace, but belong to Yuta Tomino (sp?) and Luke Guest.

Despite Ada being quite heavily used in certain industries, Ada's FOSS community is small. Extremely small. This kind of fragmentation isn't doing any good, and does more to hurt each other than to drive anything forward.

So now use and growth for the marketplace extensions:

  • Del Sole's
    • 3,524 installs
    • Averaging 2.53 installs per day
  • Mine (not including separate snippets extension)
    • 7,383 installs
    • Averaging 10.24 installs per day
  • Yours
    • 312 installs
    • Averaging 3.00 installs per day

I've overwhelmingly focused on the syntax classifier, as it's closest to the expertise I've spent a decade and a half developing. I haven't had any desire nor time required to implement an LSP. While the initial implementation was created while also learning how VS Code does classification, it came out decently well, and was able to classify more precisely than even GPS, just with certain limitations imposed by the engine the classifier uses. More recently I've been made aware of ways to work with and work around those limitations to get near close to the EBNF definitions, and handle line breaks and other limitations much more robustly. I'll get back to this later.

Yours, on the other hand, does have LSP support. But also far from great classification.

What I'm proposing is that the two projects get combined. Your LSP, my syntax classifier.

This would have a number of benefits, not including the few related to my intentions, which will be covered later.

  1. Reduced fragmentation of tooling. As stated, this doesn't do the community any good. It splits resources in an already small community.
  2. Reduced fragmentation of community. The subset of Ada programmers who are also VS Code users is even smaller. Fragmenting this community causes even more problems. The bizarre thing is, for highly utilized languages like C and C++, there's only one language extension in the marketplace (until you hit the back pages; wouldn't recommend that in general), with a number of related extensions adding in features on top, not recreating the extension.
  3. Your team can focus more on LSP development. I shouldn't need to explain this, right? It reduces fragmentation of resources within your own team.
  4. My knowledge of Regex and VS Code behavior/quirks. I've given your team a few sophisticated Regex examples to replace some very basic ones your team has provided. Regex is tricky, and VS Code's flavor is no where near a common one, with a lot of unexpected behaviors if you're coming at it expecting it to behave like PCRE or JSRE.

So now my intentions, since this is admittedly quite an unusual situation, especially as I'm the author of the more popular and still faster growing extension, yet coming to you.

I'm copypastaing this, since I've already written it out elsewhere, and the explanation given there is close enough to appropriate for here that you'll figure it out.

As mentioned when I was elaborating my concerns, I have sensory integration/processing issues, which are highly comorbid with autism spectrum disorders. To be specific and formal, I have both Sensory Modulation Disorder and Synesthesia. Because these aren't widely known, I'll provide a basic explanation of them.

SMD's are a highly specific spectrum of sensory disorders where sensory stimuli are overprocessed, underproccessed, or insatiably craved. A very widely known form of this with ASD is the comfort that "weight" on the body can provide. Overprocessing can manifest as extreme reactions to a stimulus, and underprocessing can manifest as a lack of reaction to a stimulus. I both overprocess and underprocess. I do not have any SMD issues specifically related to computers, although some are generic enough that they can still present. Certain tactile stimuli are extremely overprocessed, to the point of certain fabrics making me nauseous and causing a spike in blood pressure. There is no consistency or pattern in how this happens. I generally just have to encounter it and avoid it from then on.

Synesthesia on the other hand, is where a sensory stimulus crosses cognitive pathways. This typically is another sensory pathway, although there are observed cases of it crossing into other non-sensory cognitive pathways (as happens to me sometimes). This is very hard to explain for people who've never experienced it, but basically, certain sensory stimuli cause additional sensations or responses that are not appropriate. The most common type, which I do not have, but is simple to explain, is chromagrapheme synesthesia, whereby graphemes (letters in English) are associated with colors and will be colorized regardless of their printed/displayed color.

The recent problems that have been sticking around is related to a very specific stimulus: my mouse moving over the mousepad. I'm not sure what the specific thing is, whether it's about the sound or texture or whatever. I haven't been able to figure it out. Other mousepads still trigger it, although I don't have another mouse to test with. Some days are better than others, with some not effecting me at all. But it's been bad enough that I can't reasonably maintain use of a mouse for more than few basic operations every hour most days. On one of the particularly bad days, the required mouse use I had to engage in (for something unrelated, but it's the effect that's important), the combination of synesthesia and overprocessing was enough that I had to go mute for the remainder of the day, and completely isolate myself; at the time I hadn't seen my girlfriend in two weeks and that was the day we had planned to do something.

Due to accessibility concerns and difficulties with VS Code, I've recently been rendered largely unable to use it. By contrast, use of other tooling hasn't been anywhere near effected, and I've had no problem continuously developing other things. Despite being made aware of ways to considerably enhance the classifier to work around limitations of VS Code, I've only been able to partially do the rework. Just shy of a month ago, the problems mentioned in the copypasta had grown bad enough to render continued development of anything in VS Code too problematic.

Implement problem matcher

VS Code has a method for integrating analyzer output with the text editors gutter, through the problem matcher API. This would allow the errors and warnings that gnatmake produces to be put directly into the editor in the files and on the lines that is being reported.

It seems like, despite the official docs only mentioning doing this in the tasks.json file, per project, it can actually be provided via the extension inside of the package.json's contributes, as a problemMatchers array.

Constraint error

Hello,
The error I'm facing when I'm trying to edit some large files:

[Error - 4:29:39 PM] Request textDocument/documentSymbol failed.
Message: CONSTRAINT_ERROR
[/net/sdp/homes/icolesa/.vscode-server/extensions/adacore.ada-21.0.12/linux/libgnatcoll.so.0]
0x7fa8188df77f gnatcoll__projects__is_aggregate_project at ???
0x7fa818940cbc gnatcoll__projects__aggregated_projects.localalias.1086 at ???
[/net/homes/icolesa/.vscode-server/extensions/adacore.ada-21.0.12/linux/ada_language_server]
Lsp.Ada_Handlers.Load_Project at lsp-ada_handlers.adb:2579
Lsp.Ada_Handlers.Ensure_Project_Loaded at lsp-ada_handlers.adb:489
Lsp.Ada_Handlers.Get_Open_Document at lsp-ada_handlers.adb:230
Lsp.Ada_Handlers.On_Document_Symbols_Request at lsp-ada_handlers.adb:2110
Lsp.Error_Decorators.Document_Symbols_Request at lsp-error_decorators.adb:45
Lsp.Error_Decorators.On_Document_Symbols_Request at lsp-error_decorators.adb:341
Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:175
Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:1072
Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:1148
[/net/sdp/homes/icolesa/.vscode-server/extensions/adacore.ada-21.0.12/linux/libgnarl-2019.so]
0x7fa816a413f4 system__tasking__stages__task_wrapper at ???
[/lib/x86_64-linux-gnu/libpthread.so.0]
0x7fa81643ffa1
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fa81634f4cd
0xfffffffffffffffe

Code: -32603
[Error - 4:29:39 PM] Request textDocument/foldingRange failed.
Message: CONSTRAINT_ERROR
[/net/homes/icolesa/.vscode-server/extensions/adacore.ada-21.0.12/linux/ada_language_server]
Lsp.Ada_Context_Sets.Context_Lists.First_Element at a-cdlili.adb:533
Lsp.Ada_Context_Sets.Get_Best_Context at lsp-ada_context_sets.adb:88
Lsp.Ada_Handlers.On_Folding_Range_Request at lsp-ada_handlers.adb:1510
Lsp.Error_Decorators.Folding_Range_Request at lsp-error_decorators.adb:45
Lsp.Error_Decorators.On_Folding_Range_Request at lsp-error_decorators.adb:197
Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:235
Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:1072
Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:1148
[/net/sdp/homes/icolesa/.vscode-server/extensions/adacore.ada-21.0.12/linux/libgnarl-2019.so]
0x7fa816a413f4 system__tasking__stages__task_wrapper at ???
[/lib/x86_64-linux-gnu/libpthread.so.0]
0x7fa81643ffa1
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fa81634f4cd
0xfffffffffffffffe

Environment:

  • version: 21.0.12-dbg
  • OS: Debian GNU/Linux 10 (buster)
  • gnat version: GNAT Community 2019 (20190517-83)
  • editor: VS Code 1.45.1

For the moment I cannot reproduce the above error using a small example. Is there any advice you can give me in order to find out how to reproduce that error using a small example?
Thanks.

Project file not attempted to be loaded - fails to find any references not in the current file

ALS seems to work fine within one file. But as soon as I try to jump to a reference in a different file, ALS reports 'LC: Not found'. I am using ALS from NeoVim with autozimu/LanguageClient-neovim.

I tried putting the .vim/settings.json next to the project, i.e.:

├── ageindays.gpr
├── obj
│   ├── agecalculator.adb.stderr
│   ├── agecalculator.adb.stdout
│   ├── agecalculator.ali
│   ├── agecalculator.o
├── src
│   ├── agecalculator.adb
│   ├── agecalculator.ads
│   ├── ageindays.adb
│   ├── dateinput.adb
│   ├── dateinput.ads
│   ├── stringutil.adb
│   └── stringutil.ads
└── .vim
    └── settings.json

I also tried putting it in ~.vim/. In both cases, I also tried misspelling the gpr file, so that I could search for the error message that should be output when not finding the project file (added here), but didn't see that error in either case. I also enabled traces and read the resulting traces when trying to jump to a reference in a different file, but found no mention in the traces of searching for a project file.

So I'm still mystified on how to get ALS to see the project file and use that information to jump to references outside the current file.

Procedure separates usage not found by reference search

Procedure reference searches, when the procedure is declared as a separate, are only returning the .adb and .ads file where the procedure is declared. Implementation searches, in this same case, only return the .adb file where the procedure is declared, and the .adb file where the procedure is implemented. Neither reference search returns uses of the procedure in other files. Function separates behave the same as procedures.

More highlighting issues

hl_problem_1
hl_problem_2
hl_problem_3
hl_problem_4

The last one with the wrongly highlighted comments is the most concerning to me. If you want to reproduce, the file lsp-ada_handlers.adb is from the ALS repo.

Honestly at this stage I think we should either:

  • Have some kind of dumb "token highlighting" fallback on master, and maybe have a highlighting-dev branch where it is deactivated so that remaining holes are still visible, as discussed in #412
  • Completely roll back the new highlighter in favor of the old dumb one, and have the new one on a branch.

This should be complemented by extensive testing one way or another.

VSCode extension error: couldn't start client Ada Language Server

Hello, i'm trying to use the Visual Studio Code extension (installed using the provided .vsix file) but when i start VSCode i always get the following error "couldn't start client Ada Language Server" with the following output console:
[Error - 10:11:08] Starting client failed Error: spawn UNKNOWN at ChildProcess.spawn (internal/child_process.js:394:11) at Object.spawn (child_process.js:548:9) at d:\Users\T0123624\.vscode\extensions\maximreznik.ada-21.0.2\node_modules\vscode-languageclient\lib\main.js:354:40
I have GNATPRO 19.2 set in my path.
What am I missing ?

Thx for the help

Failure of Shared Libraries?

libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "gnatcoll_gmp"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "gnatcoll"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "xmlada_dom"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "xmlada_input"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "xmlada_unicode"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "xmlada_sax"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "xmlada_schema"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "gpr"
libadalang.gpr:14:17: shared library project "libadalang" cannot import static library project "gnatcoll_iconv"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "gnatcoll"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "xmlada_dom"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "xmlada_input"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "xmlada_unicode"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "xmlada_sax"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "xmlada_schema"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "gpr"
langkit_support.gpr:12:17: shared library project "langkit_support" cannot import static library project "gnatcoll_iconv"

Highlighting of nested declarations is failing

See attached screenshot

failure

with this following snippet of code

with Ada.Text_IO;

procedure Main is
   package B is
      procedure C is
      begin
      end C;
   end B;

   procedure D is
   begin
   end D;
begin
end Main;

Possible Feature - Settings for gnat compiler path?

Do you think adding a setting hereish? for the adainclude folder path might be a good idea?

for example mine is in:
$GNAT_ROOT/lib/gcc/x86_64-pc-mingw32/7.3.1/adainclude

This should allow the server to index all these files and give autocomplete, hover documentation, goto definition, etc for standard library stuff.

I'll try and give it a shot, but no promises.

Add .editorconfig

You guys use unique styling conventions. By adding an .editorconfig file all supporting editors will automatically use the appropriate project style conventions, which reduces contributor and reviewer friction. Supporting editors include VS Code, Emacs, Vim, and more. There's no negative impact to this. Non supporting editors will adhere to their user preferences, and supporting editors only use the .editorconfig preferences in that workspace, preserving user settings otherwise.

Visual Studio 2017 - Integration

Hi AdaCore

I've done a quick mock-up of a language server in Visual studio 2017 (NOT to be confused with Visual Studio Code) using the sample / instructions given at https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-an-lsp-extension?view=vs-2017
After some minor tweaks, to-do with project references, and not the actual code itself) this seem to work!

However I've noticed that this GitHub version does not seem to implement a response to the "initialize" json request, and hence VS2017 (as apposed to VSCode) aborts/fails loading the addin/extension.

Not sure what's going on here, and maybe I've misread the Ada code

Please advise

Thanks Alex

Constraint error: Code completion of with clauses

I am using GNAT Community 2019 (20190517-83) on Ubuntu 18.04.3 LTS. I downloaded the files ada-0.0.1.vsix and linux.tar.gz from this page and I installed the extension using the command code --install-extension ada-0.0.1.vsix.

I tried to start with this minimal example code:

procedure Main is
begin
   null;
end Main;

After typing with Ada. at the beginning of the file the following message appears in the Output pane:

[Error - 8:11:38 PM] Request textDocument/completion failed.
  Message: CONSTRAINT_ERROR
[/home/user/.vscode/extensions/adacore.ada-0.0.1/linux/libadalang.so]
Libadalang.Env_Hooks.Name_To_Symbols.Localalias at libadalang-env_hooks.adb:190
Libadalang.Env_Hooks.Name_To_Symbols.Localalias at libadalang-env_hooks.adb:196
Libadalang.Env_Hooks.Fetch_Unit at libadalang-env_hooks.adb:231
Libadalang.Implementation.Name_P_Internal_Referenced_Unit at libadalang-implementation.adb:116394
Libadalang.Implementation.Name_P_Referenced_Unit at libadalang-implementation.adb:112576
Libadalang.Implementation.Env_Do_117 at libadalang-implementation.adb:77173
Libadalang.Implementation.Bare_Base_Subp_Body_Pre_Env_Actions at libadalang-implementation.adb:76340
Libadalang.Implementation.Pre_Env_Actions at libadalang-implementation.adb:4523
Libadalang.Implementation.Populate_Lexical_Env.Populate_Internal at libadalang-implementation.adb:5379
Libadalang.Implementation.Populate_Lexical_Env.Populate_Internal at libadalang-implementation.adb:5385
Libadalang.Implementation.Populate_Lexical_Env.Populate_Internal at libadalang-implementation.adb:5385
Libadalang.Implementation.Populate_Lexical_Env at libadalang-implementation.adb:5416
Libadalang.Implementation.Populate_Lexical_Env at libadalang-implementation.adb:607
Libadalang.Implementation.Dispatcher_Ada_Node_P_Complete at libadalang-implementation.adb:17188
Libadalang.Analysis.P_Complete at libadalang-analysis.adb:10190
[/home/user/.vscode/extensions/adacore.ada-0.0.1/linux/ada_language_server]
Lsp.Ada_Documents.Get_Completions_At at lsp-ada_documents.adb:429
Lsp.Ada_Handlers.On_Completion_Request at lsp-ada_handlers.adb:1867
Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:55
Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:937
Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:1021
[/home/user/.vscode/extensions/adacore.ada-0.0.1/linux/libgnarl-2019.so]
0x7fb7d7af73f4 system__tasking__stages__task_wrapper at ???
[/lib/x86_64-linux-gnu/libpthread.so.0]
0x7fb7d6f1c6d9
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fb7d682988d
0xfffffffffffffffe

  Code: -32603 

Visual Studio Code debugging?

Hi,

I just wanted to know if integrated debugging of Ada source code in Visual Studio Code is a planned feature for the VSC extension, or whether if this feature would fit in the scope of the extension at all.

Thanks.

Crash attempting to load libgmp on darwin

In 21.0.13, the server crashes repeatedly on startup with the following message:

dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: /Users/tony/.vscode/extensions/adacore.ada-21.0.13/darwin/libadalang.dylib
  Reason: image not found
[Info  - 4:46:09 PM] Connection to server got closed. Server will restart.

This happens five times in a row with identical timestamps - but the server does seem to be working, at least as far as basic syntax highlighting goes.

The error is accurate: I definitely do not have libgmp (any version) in /usr/local/opt. I'm not sure why the server would assume I would, in fact. On my machine (macOS 10.15), /usr/local/opt is entirely filled with symlinks to Cellar-installs of things that I've installed with homebrew.

That directory is owned by my user; was the server supposed to be able to put the missing library there when it installed itself?

I'll note that I don't see anything in the README suggesting that I ought to have install libgmp.

Support for Old-Style File Endings

I'm relatively new to ada programming, so apologies if this is something that's already been accounted for and I just can't find the appropriate settings, but when using ALS in the built-in neovim lsp on lines such as:

separate (Foo.Bar)

I get the error: file "foo-bar.adb" not found. My understanding is that this is the modern naming scheme for an ada project, but my company uses an old naming scheme. Instead we would have a file called foo.bar.2.ada. Is there a way to have the language server recognize this other naming scheme?

Set up VS Code automated testing

Perhaps it's time for us to look into setting up VS Code automated testing - the code is becoming too important to be tested manually. Don't hesitate to send pointers if you happen to have experience with this.

Originally posted by @setton in #377 (comment)

Visual Studio Code "gpr-aware" problemMatcher ?

Hi
Start to evaluate ALS using the Visual Studio Code extension.
In the build task provided , problemMatcher is set to "$ada"

If I use the same task with my own projects, it sems that it will only let me jump to the correct file/line when the build task displays an error if .gpr and .adb are in the same folder - as only the source file base name is displayed and problemMatcher is not "gpr-aware"

Am I right or did I miss something ?

"Dereferencing a null access" results in empty responses

Environment:

  • version: 21.0.4-dbg
  • OS: Windows 7
  • gnat version: `GNAT Pro 7.3.1 (20150118-49)
  • editor: Emacs 26.3

traces.cfg contains: ALS.*=yes > inout.txt:buffer_size=0

inout.txt contains (redacted):

[ALS.IN] {"jsonrpc":"2.0","method":"textDocument/hover","params":{"textDocument":{"uri":"file:///d:/dummy.adb"},"position":{"line":2728,"character":4}},"id":8}
[ALS.MAIN] Hover_Request: Request  8 file:///d:/dummy.adb:2728:4
[ALS.MAIN] LIBADALANG.COMMON.PROPERTY_ERROR: dereferencing a null access
_ALS.MAIN_ [...\ada_language_server\libadalang\libadalang.dll]
_ALS.MAIN_ 0x267539f at ???
_ALS.MAIN_ [...\ada_language_server\libadalang\libadalang.dll]
_ALS.MAIN_ 0x20f4699 at ???
_ALS.MAIN_ [...\ada_language_server\ada_language_server.exe]
_ALS.MAIN_ Lsp.Lal_Utils.Resolve_Name at lsp-lal_utils.adb:368
_ALS.MAIN_ Lsp.Ada_Handlers.Imprecise_Resolve_Name at lsp-ada_handlers.adb:300
_ALS.MAIN_ Lsp.Ada_Handlers.On_Hover_Request at lsp-ada_handlers.adb:1214
_ALS.MAIN_ Lsp.Error_Decorators.Hover_Request at lsp-error_decorators.adb:45
_ALS.MAIN_ Lsp.Error_Decorators.On_Hover_Request at lsp-error_decorators.adb:229
_ALS.MAIN_ Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:127
_ALS.MAIN_ Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:1012
_ALS.MAIN_ Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:1089
_ALS.MAIN_ [...\ada_language_server\libgnarl-2019\libgnarl-2019.dll]
_ALS.MAIN_ 0x712d43bc ada__real_time__timing_events__events__iterateXnn at ???
_ALS.MAIN_ [C:\WINDOWS\system32\kernel32.dll]
_ALS.MAIN_ 0x7705556b
_ALS.MAIN_ [C:\WINDOWS\SYSTEM32\ntdll.dll]
_ALS.MAIN_ 0x772b372b
[ALS.MAIN] LIBADALANG.COMMON.PROPERTY_ERROR: dereferencing a null access
_ALS.MAIN_ [...\ada_language_server\libadalang\libadalang.dll]
_ALS.MAIN_ 0x267539f at ???
_ALS.MAIN_ [...\ada_language_server\libadalang\libadalang.dll]
_ALS.MAIN_ 0x20f4699 at ???
_ALS.MAIN_ [...\ada_language_server\ada_language_server.exe]
_ALS.MAIN_ Lsp.Lal_Utils.Resolve_Name at lsp-lal_utils.adb:385
_ALS.MAIN_ Lsp.Ada_Handlers.Imprecise_Resolve_Name at lsp-ada_handlers.adb:300
_ALS.MAIN_ Lsp.Ada_Handlers.On_Hover_Request at lsp-ada_handlers.adb:1214
_ALS.MAIN_ Lsp.Error_Decorators.Hover_Request at lsp-error_decorators.adb:45
_ALS.MAIN_ Lsp.Error_Decorators.On_Hover_Request at lsp-error_decorators.adb:229
_ALS.MAIN_ Lsp.Servers.Handle_Request at lsp-servers-handle_request.adb:127
_ALS.MAIN_ Lsp.Servers.Processing_Task_Type.Process_Message at lsp-servers.adb:1012
_ALS.MAIN_ Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:1089
_ALS.MAIN_ [...\ada_language_server\libgnarl-2019\libgnarl-2019.dll]
_ALS.MAIN_ 0x712d43bc ada__real_time__timing_events__events__iterateXnn at ???
_ALS.MAIN_ [C:\WINDOWS\system32\kernel32.dll]
_ALS.MAIN_ 0x7705556b
_ALS.MAIN_ [C:\WINDOWS\SYSTEM32\ntdll.dll]
_ALS.MAIN_ 0x772b372b
[ALS.MAIN] Hover_Response: Response  8  0
[ALS.OUT] {"jsonrpc":"2.0","id":8,"result":{"contents":[]}}

I could not reproduce the error using a smaller example and I'm not allowed to share code.

Update VSCode extension link in README

The link for the VSCode extension is outdated and points to an older extension that isn't working (20.0.999 vs 21.0.15). This was confusing as I assumed it was linked to the latest version of the extension.

We also provide [Visual Studio Code](https://code.visualstudio.com/)
[extension as .vsix file](https://dl.bintray.com/reznikmm/ada-language-server/ada-20.0.999.vsix).

I would either remove the link entirely and instruct the user to search for the extension in the VSCode marketplace or update it to point to the proper VSCode extenstion.

Not working/missing something on Windows 10 : https://github.com/reznikmm/spawn

Note: I am reporting here because the issues section is not enabled on https://github.com/reznikmm/spawn. Please enable this section so we can report properly.

The following will output, as expected, 'me here':

with Ada.Text_IO;
--with Spawn.Processes;

procedure test is
begin
   Ada.Text_IO.put_line("me here");
end;

The following will hinder any output at all, tested on Powershell and cmd:

with Ada.Text_IO;
with Spawn.Processes;

procedure test is
begin
   Ada.Text_IO.put_line("me here");
end;

No support for numerical bases, supradecimal notation, nor e-notation

image

As you can see, the base specifiers aren't being highlighted, and I suspect the only reason why the base is highlighted at all is it's recognized as a discrete and unique number.

For what it recognizes of one of the parts of a number, 52_ it's not marking this as invalid, despite it being invalid according to the ARM

image

The A isn't being recognized despite being part of a hexadecimal literal, which causes me to think that any supradecimal notation isn't recognized.

And lastly e- isn't recognized as part of e-notation (I'm not sure if this should be recognized as an operator {which conceptually it is} or as part of the numeral {which the ARM defines it as}). And yes e-notation is allowed for based numeric literals.

image

Intellisense reporting everything in scope

Rather than reporting what would be a valid completion for the given context, intellisense seems to be reporting everything known within the current scope, without any contextual discrimination.

image

And no matter the leading context.

image

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.