LuaLS / LuaLS/lua-language-server

[Feature Request] Named Environment/Configuration Selection

Open
#1,957 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Libraries

Expected Behaviour

Not sure how best to word the title, but essentially, having different configuration names that the user can swap between would be nice. This is probably a really unlikely needed thing, but it's something I would need for my meta information.

Actual Behaviour

You can't specify some kind of named configuration.

Reproduction steps

N/A

Additional Notes

If you see https://github.com/LuaLS/lua-language-server/discussions/1834, I want to be able to differentiate between when certain functions exist/overload. The problem is that I can't really do that as-is, that I can tell at least. One thing I tried to look into were the configuration file details, but there's not a lot of documentation.

Ideally, I would be able to let the user specify how one of my variables is defined, e.g. love._console_name in my case would be 3DS, Switch or Wii U. I could then do something like so:

---@meta

---
---Provides access to information about the user's system.
---
---
---[Open in Browser](https://love2d.org/wiki/love.system)
---
---@class love.system
love.system = {}

if love._console_name == "3DS" then
	local play_coins = 0
	---Set the Play Coin count. \
	---This function is **ONLY** available on _Nintendo 3DS_.
	---@param coins integer
	function love.system.setPlayCoins(coins)
	    play_coins = coins
	end
	
	---Get the Play Coin count. \
	---This function is **ONLY** available on _Nintendo 3DS_.
	---@return integer current_coins
	function love.system.getPlayCoins()
	    return play_coins
	end
end

return love.system

and it would only show these as defined when on a "3DS" configuration.

The C++ Visual Studio Code extension has something similar:
image

Log File

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is named. Start by reviewing the configuration documentation and discussion 1834 to understand how conditional definitions could be selected by a named configuration; done would mean users can switch configurations and see only the matching definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, vscode
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.