Giter VIP home page Giter VIP logo

Comments (2)

4P5 avatar 4P5 commented on June 23, 2024

I'm working with a similar syntax, a,b -> expr.

I was able to disable warnings for the lines my expression is used on with a plugin, though this doesn't properly integrate with the language server. You might be able to transform your syntax into the regular Lua syntax, which the language server would work with.

function OnSetText(uri, text)
    local diffs = {}

    for line in text:gmatch("->[^\n]*()") do
	    diffs[#diffs+1] = {
		    start = line - 1,
		    finish = line - 1,
		    text = "--[[@diagnostic disable-line: undefined-global, unknown-symbol, redundant-parameter]]"
	    }
    end
    
    return diffs
end

from lua-language-server.

bavalpey avatar bavalpey commented on June 23, 2024

I'm working with a similar syntax, a,b -> expr.

I was able to disable warnings for the lines my expression is used on with a plugin, though this doesn't properly integrate with the language server. You might be able to transform your syntax into the regular Lua syntax, which the language server would work with.

function OnSetText(uri, text)
    local diffs = {}

    for line in text:gmatch("->[^\n]*()") do
	    diffs[#diffs+1] = {
		    start = line - 1,
		    finish = line - 1,
		    text = "--[[@diagnostic disable-line: undefined-global, unknown-symbol, redundant-parameter]]"
	    }
    end
    
    return diffs
end

Yeah so I looked into this and realized it was the route I would have to take until this is supported. However, your precise solution is brittle from my perspective as it doesn't respect the precise syntax of lua expressions. (Stopping at a newline?). Also wouldn't support nested lambda expressions.
I would need to hook into something like LPEG. From my point of view, if I can't give it full and proper support, it's better to give no support.

from lua-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.