pherrymason / c3-lsp

Language Server for C3 Language
https://pherrymason.github.io/c3-lsp/
GNU General Public License v3.0
64 stars 9 forks source link

Hover does not show default arguments #81

Open Caleb-o opened 1 month ago

Caleb-o commented 1 month ago

Describe the bug C3 has default function arguments, which seem mostly in cases of allocation based functions. Currently hover does not show what those arguments are.

To Reproduce

module myproject;

import std::io;

fn void using_default(int foo, bool bar = false) {
  io::printfn("foo %s, bar %s", foo, bar);
}

fn void main() {
  using_default(10);
  using_default(20, true);
}

Collections example:

import std::io;
import std::collections::map;

def IntMap = map::Map(<String, int>);

fn void main() {
  IntMap imap = map::new(<String, int>)();
  defer imap.free();

  imap.set("Hello", 100);
  io::printfn("hello = %s", imap.get("Hello")!!);
}

Expected behavior Show default arguments

Screenshots image image image

Desktop (please complete the following information):

pherrymason commented 1 month ago

Notes: Current structure is not parsing default values assigned to arguments.
Indexable arguments should be able to accomodate those references. Maybe a simple string would suffice?