Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmmyLua plugin as an extension #417

Closed
Ketho opened this issue Feb 23, 2021 · 3 comments
Closed

EmmyLua plugin as an extension #417

Ketho opened this issue Feb 23, 2021 · 3 comments

Comments

@Ketho
Copy link

Ketho commented Feb 23, 2021

I want to create a VS Code extension which provides EmmyLua annotations to the Lua language server.
https://github.com/Ketho/vscode-wow-api/tree/master/EmmyLua

Currently I'm trying to add a dependency and edit your Lua.workspace.library configuration.

"extensionDependencies": [
	"sumneko.lua"
]
let luaConfig = vscode.workspace.getConfiguration("Lua")
let path = "C:\\Users\\Ketho\\.vscode\\extensions\\ketho.wow-api-0.0.2\\EmmyLua"
luaConfig.workspace.library[path] = true

But this doesn't work since the configuration seems to be a proxy object. I also don't know how to use a relative path to my extension's emmylua folder.

What is the proper way to make an EmmyLua plugin/extension? I looked at https://github.com/sumneko/lua-language-server/wiki/Plugin-(Experimental) but that seems to be for something different 😕

*Sorry if this issue should be filed under https://github.com/sumneko/vscode-lua

@sumneko
Copy link
Collaborator

sumneko commented Feb 24, 2021

You should use luaConifg.update(key, value).
Path can be found in ExtensionContext.extensionPath

@Ketho
Copy link
Author

Ketho commented Feb 24, 2021

Thank you, that worked for me 😄
I'd appreciate any advice or suggestions on my code.

let extension = vscode.extensions.getExtension("ketho.wow-api")
let path = extension?.extensionPath+"\\EmmyLua"

let luaConfig = vscode.workspace.getConfiguration("Lua")
let library: any = luaConfig.get("workspace.library")
library[path] = true
luaConfig.update("workspace.library", library, true)

Should I make a wiki article for other people who want to make an emmylua plugin or is this conventional knowledge?

@Ketho Ketho closed this as completed Feb 24, 2021
@sumneko
Copy link
Collaborator

sumneko commented Feb 24, 2021

Should I make a wiki article for other people who want to make an emmylua plugin or is this conventional knowledge?

Of course, this can help a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants