Skip to content

skulidropek/language-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tact language server cover

Tact Language Server

Features

  • Syntax highlighting
  • Code completion
  • Go to definition
  • Find references
  • Hover information
  • Diagnostics
  • Code formatting
  • Inlay hints

Installation

First, clone and build the language server:

git clone https://github.com/i582/language-server
cd language-server
yarn install
yarn build

VS Code

The easiest way to get started with Tact is using VS Code:

  1. Run the following command to create the VSIX package:
yarn package
  1. In VS Code:
    • Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
    • Type "Install from VSIX"
    • Select the generated .vsix file
    • Reload VS Code

The extension will automatically activate when you open any .tact file.

Configuration

The language server supports the following settings:

{
    tact: {
        stdlib: {
            path: "",
            // Path to Tact standard library. If empty, will try to find in node_modules
        },
        hints: {
            types: true,
            // Show type hints for variables and expressions
            parameters: true,
            // Show parameter name hints in function calls
            showMethodId: true,
            // Show method ID hints for contract functions
            exitCodeFormat: "decimal",
            // Format of exit codes in require(): "decimal" or "hex"
        },
        codeLens: {
            enabled: true,
            // Enable/disable all code lens
        },
    },
}

Helix

  1. Make sure you have Helix installed and configured
  2. Add the following configuration to your ~/.config/helix/languages.toml:
[[language]]
name = "tact"
language-servers = ["tact-language-server"]

[language-server.tact-language-server]
command = "node"
args = ["path/to/language-server/dist/server.js", "--stdio"]
  1. Replace path/to/language-server with the actual path where you cloned the repository
  2. Restart Helix for changes to take effect

Neovim

Prerequisites:

Setup steps:

  1. Add tact.lua to your lua/lspconfig/server_configurations directory with the following content:
local util = require 'lspconfig.util'

return {
  default_config = {
    cmd = { 'node', '/absolute/path/to/language-server/dist/server.js', '--stdio' },
    filetypes = { 'tact' },
    root_dir = util.root_pattern('package.json', '.git'),
  },
  docs = {
    description = [[
      Tact Language Server
      https://github.com/i582/language-server
    ]],
    default_config = {
      root_dir = [[root_pattern("package.json", ".git")]],
    },
  },
}
  1. Add the following to your init.lua:
require'lspconfig'.tact.setup {}

Sublime Text

  1. Install LSP package:

    • Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
    • Select "Package Control: Install Package"
    • Search for and select "LSP"
  2. Install the Tact package via Package Control for syntax highlighting

  3. Add the following configuration to your LSP settings (Preferences > Package Settings > LSP > Settings):

{
    "clients": {
        "tact": {
            "enabled": true,
            "command": ["node", "path/to/language-server/dist/server.js", "--stdio"],
            "selector": "source.tact"
        }
    }
}
  1. Create a new file with .tact extension to verify the setup

Troubleshooting

Common issues:

  • Path to the language server is incorrect
  • Node.js is not installed
  • Language server wasn't built properly

Logs Location

The language server generates logs that can help diagnose issues:

  • For standalone server: logs are written to dist/tact-language-server.log in the language server directory
  • For VS Code extension: logs can be found in:
    • Windows: %USERPROFILE%\.vscode\extensions\tact-[version]\dist\tact-language-server.log
    • macOS/Linux: ~/.vscode/extensions/tact-[version]/dist/tact-language-server.log

For more help, please open an issue.

License

MIT

About

Just experiments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 77.5%
  • Scheme 11.2%
  • JavaScript 9.0%
  • Tact 1.5%
  • CMake 0.8%