Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Jai language server prototype

License

NotificationsYou must be signed in to change notification settings

SogoCZE/Jails

Repository files navigation

Jails is an experimental language server for the Jai programming language.

Features

  • Basic Go-To Definition
  • Autocomplete for available symbols (types, procedures etc)
  • Signature help for procedure calls
  • Error reporting from the compiler

In the future, the language server will support all other basic stuff you would get from any other LSP. Also, the plan is to support some specific Jai features from an editor support perspective like for example macro evaluation inside the editor etc.

Usage

Be aware that this language server is still pretty much unstable... Nonetheless, it can be quite useful even in this early stage of development.

Requirements

  • You need to have aJai compiler in your path. The language server searches for the compiler withwhereis on Mac, Linux andwhere on Windows. You can also specify the compiler path with a command line argument to Jails with-jai_path /path/to/compiler/jai.
  • You may need to createjails.json config file to properly support your project structure. In the future I would like to Jails work for most of the Jai projects out-of-box without any config but for now it is recommended you set up one.

When using a custom Build program

By default, Jails does not generate any output files, however, when using a custom build program it will output whatever your build program is set to. In that case, you should disable the output on your own, by combiningJAILS_DIAGNOSTICS_BUILD with#exists to detect if it is build by the LSP.

#if#exists(JAILS_DIAGNOSTICS_BUILD) options.output_type = .NO_OUTPUT;

If you happen to have more than one layer of meta programms triggering, you can do the following:

default_metaprogram_command_lind :=get_build_options(1).compile_time_command_line;found, index :=array_find(default_metaprogram_command_lind,"jails_diagnostics");if found  child_options.output_type = .NO_OUTPUT;

Cloning

This repo uses git submodules. Clone it usinggit clone --recurse-submodules.

Building

Compile the release version of the server withjai build.jai - -release. Jails binary will be generated in thebin folder.

VS Code

Jails for VS Code can be downloaded fromVS Code Marketplace or you can build it yourself. The prebuilt version supports x64 Windows and ARM64 MacOS at the moment.

Manual build

  1. Make sure this repo is your working directory (e.g.cd Jails).
  2. Runnpm install --global @vscode/vsce to install the Visual Studio Code Extension Manager.
  3. Runjai build.jai - -release to build the binary.
  4. Runcd vscode_extension to enter the subdirectoryvscode_extension.
  5. Runnpm install to install npm dependencies.
  6. Runnpm run compile to generate an extension bundle.
  7. Runnpm run pack:<platform> (mac, linux, windows) to pack the bundle into a file called something likejails-x.x.x.vsix.
  8. Runcode --install-extension jails-x.x.x.vsix to install the extension in VS Code.

Config file

You can create a config filejails.json inside your project root to specify:

  • roots (main.jai,build.jai) - this is used to set up files that are being parsed on init - you don't need to set this but it will improve your experience.
  • local modules (modules) - this tells the language server to also search for modules in these folders.
  • build_root - entry file for compiling (currently used for running compiler diagnostics - errors in the editor)
{"local_modules": ["modules"    ],"roots": ["server/main.jai","build.jai"    ],"build_root":"build.jai"}

Run (dev)

Compile server withjai build.jai or compile and run test VSCode with preinstalled LSP withjai build.jai - -vscode.

Dependencies


[8]ページ先頭

©2009-2025 Movatter.jp