Sublime Forum

Project-specific package settings?

#1

I’m stuck on how to set settings that are normally in Packages/User/.sublime-settings files for things that are project specific, eg. in this case for LSP-elixir. Google only turns up a dead thread on SO for ST2, and maybe I’m googling it wrong, but I can’t find the info for ST4. Any pointers?

0 Likes

Can't set gopls buildFlags in project settings
#2

In general, setting in a project go into a "settings" key in the sublime-project file. However, it’s up to whatever code is looking things up in settings to know to look to get project specific settings that are set that way, so if the package doesn’t support it, it can’t be done.

I don’t use LSP so I’m not aware offhand if it supports something like that (though it seems like it would based on what it does). Does the documentation for the package say anything about how to configure it?

0 Likes

#3

Thanks, that seems like a direction to look into! LSP-elixir does refer to the LSP configuration, but I have no idea what that means, yet, having no prior experience with how sublime packages work internally.

0 Likes

#4

I have a similar problem; the documentation for LSP says it supports per-package settings, but it’s not clear how far that support goes. I’ve been trying to override the environment from global settings which begin

{
     "clients":
     {
         "gopls":
         {
             "command": ["/Users/drchase/go/bin/gopls"],
             "enabled": true,
             "env": {
                 "PATH": "/Users/drchase/go/bin:/Users/drchase/work/go/bin",
                 "GOROOT": "/Users/drchase/work/go",
                 "GOPATH": ""
             },

with a project file that begins (all the same, except replace “go” with “go-debug”)

{
   "folders":[
      {
         "follow_symlinks":true,
         "path":"/Users/drchase/work/go-debug/src"
      }
   ],
   "settings":{
      "LSP":{
         "clients":{
            "gopls":{
               "env":{
                  "PATH":"/Users/drchase/go/bin:/Users/drchase/work/go-debug/bin",
                  "GOROOT ":"/Users/drchase/work/go-debug",
                  "GOPATH":""
               },

that is, modified global settings nested inside "settings":{"LSP": but it isn’t working — but the same settings do work properly pasted in at the global level. I think it would need to run a separate instance of gopls for each project to accomplish this, and maybe it’s not built that way.

0 Likes

#5

Hi @dr2chase, remove the additional “clients” nesting and you should be good. Docs need to be improved in this area, I agree.

So to be clear, JSON path should be /settings/LSP/gopls, not /settings/LSP/clients/gopls.

1 Like

#6

By the way, LSP-json helps in this area because it verifies your sublime config files against a schema.

0 Likes

#7

I think I need to find out how to enable LSP-json. Thanks very much, that worked.

0 Likes