Skip to content

LSP implementation for the Octave progamming language

License

Notifications You must be signed in to change notification settings

TomiVidal99/mlang

Repository files navigation

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)

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: statements can have expression within the conditions. if (3+1 == 4) etc.
  • FIX: use INFO instead of WARN in ';' missing message.
  • FIX: documentation not showing for function definitions.
  • 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: structs can be accessed inside vector outputs: '[a.x] = myFunc()'.
  • FIX: add more keywords like: 'global'.
  • FIX: functions with no parenthesis are not getting recognized.
  • 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'.

Contributors