Steps to Reproduce and Observed Behavior
Let me demonstrate using this existing ZLS test:
try testCompletion(
\\fn alpha() void {}
\\fn beta(_: anytype) void {}
\\fn gamma(_: @This()) void {}
\\
\\const foo: @This() = undefined;
\\const bar = foo.<cursor>;
, &.{
.{ .label = "beta", .kind = .Function, .detail = "fn (_: anytype) void" },
.{ .label = "gamma", .kind = .Function, .detail = "fn (_: Untitled-0) void" },
});
So what I get after selecting completion is foo.beta(_: anytype) or foo.gamma(_: Untitled-0) - but in either case, no matter what I replace the first argument with, the resulting code won't compile. I have to delete the suggested first argument - which also breaks me out of a tool I am using to iterate through the arguments with TAB and fill them in. So after accepting the suggestion I should have gotten either foo.beta() or foo.gamma() because that actually compiles and probably is what the user intended.
It might seem weird to want to instantiate "namespace" - but for example hash_map often requires context. Which just might be instantiated namespace for example std.hash_map.StringContext. It would be wrong to assume user wouldn't want to instantiate this namespace and call ctx.eql(a, b) - and ZLS is currently getting in the way a little bit.
Expected Behavior
Because the user is calling a function on an instance of type, it should clearly be suggested as a .Method, regardless of the fact that the type is a namespace. Because code that can't compile is produced by accepting the .Function suggestion and replacing argument.
Steps to Reproduce and Observed Behavior
Let me demonstrate using this existing ZLS test:
So what I get after selecting completion is
foo.beta(_: anytype)orfoo.gamma(_: Untitled-0)- but in either case, no matter what I replace the first argument with, the resulting code won't compile. I have to delete the suggested first argument - which also breaks me out of a tool I am using to iterate through the arguments with TAB and fill them in. So after accepting the suggestion I should have gotten eitherfoo.beta()orfoo.gamma()because that actually compiles and probably is what the user intended.It might seem weird to want to instantiate "namespace" - but for example hash_map often requires context. Which just might be instantiated namespace for example
std.hash_map.StringContext. It would be wrong to assume user wouldn't want to instantiate this namespace and callctx.eql(a, b)- and ZLS is currently getting in the way a little bit.Expected Behavior
Because the user is calling a function on an instance of type, it should clearly be suggested as a
.Method, regardless of the fact that the type is a namespace. Because code that can't compile is produced by accepting the.Functionsuggestion and replacing argument.