Skip to content

TomiVidal99/mlang

Repository files navigation

(STILL UNDER DEVELOPMENT)

mlang (LSP for Octave) - version 2.0.0

This is an implementation of the Language Server Protocol for the Octave programming language.

Screenshots

Screenshot

Technologies

Working features

  • Completion (some keywords, some native functions, user defined functions with default arguments (atm))
  • goToDefinition (for user defined functions in the same file (atm))
  • goToReference
  • diagnostics (closing tags, basic typing errors)

How to setup in the client

Neovim (lua)

The 'path/to/server.js' is the path to the compiled version of the server, you can find it in releases or by compiling it yourself.

local lspconfig = require("lspconfig")
local lspconfig_config = require("lspconfig.configs")
-- mlang
if not lspconfig_config.mlang then
local mlang_server = "path/to/server.js"
lspconfig_config.mlang = {
    default_config = {
        name = "mlang",
        cmd = { "node", mlang_server, "--stdio" },
        filetypes = { "matlab", "octave", "m" },
        root_dir = function()
            return vim.fn.getcwd()
            end,
        settings = {
            settings = {
                maxNumberOfProblems = 1000,
            },
        },
    },
}
end

TODO

  • FIX: struct access can be of INDENTIFER.("string")
  • FIX: if statements not working when there's a comment before the end keyword.
  • ADD: reference checking for IDENTIFIER_REFERENCE.
  • FIX: function composition not working correctly.
  • FIX: structs can be accessed inside vector outputs: '[a.x] = myFunc()'.
  • ADD: an option for selecting octave or matlab mode, there are certain things that only work on octave.
  • ADD: message for missing arguments?
  • FIX: consider all the statements inside BasicStatements when finding references and definitions.
  • FIX: linting messages are not correctly positioned.
  • FIX: statements can have expression within the conditions. if (3+1 == 4) etc.
  • MAYBE: instead of creating new instances of Tokenizer, Parser and Visitor, reuse the same.
  • FIX: 'x(1)' it's not just a function call, it could be a vector (eventually add checking that the element accessed it's valid).
  • FIX: add more keywords like: 'global'.
  • ADD: diagnostics for: redefined functions, missing imports.
  • ADD: references to files.
  • ADD: block comments.
  • ADD: Maybe consider documentation with comments on variable as well.
  • ADD: CI/CD.
  • ADD: Finish refactor on error codes (for the ERROR_CODES and the throw errors).
  • FEATURES?: Maybe have a user setting to be able to multiple variables and functions definitions, instead of grabbing the first one?
  • FEATURES: run lines of code or code blocks (%%).

Reference or Keyword not found

If a reference or a keyword it's not found and it should because it's defined by default by the language you simply add it in './src/data/completionKeywords.ts'.

Developer notes

If you want to log information into the VSCode output you can use console.error() and you'll see it in the error output terminal of the LSP in VSCode.

Contributors

About

LSP implementation for the Octave progamming language

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published