-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logic adding/not adding empty lines when formatting specs based…
… on flag/settings. (#2692) * Added logic not adding empty lines when formatting specs, as well as receiving settings from VSC Extension. Signed-off-by: Jens Johansson <[email protected]> * Added logic not adding empty lines when formatting specs, as well as receiving settings from VSC Extension. Signed-off-by: Jens Johansson <[email protected]> * Added logic not adding empty lines when formatting specs, as well as receiving settings from VSC Extension. Signed-off-by: Jens Johansson <[email protected]> --------- Signed-off-by: Jens Johansson <[email protected]>
- Loading branch information
1 parent
ce9a5a9
commit 706e32a
Showing
7 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/sourcegraph/jsonrpc2" | ||
) | ||
|
||
var currentSettings GaugeSettings | ||
|
||
type FormatConfig struct { | ||
SkipEmptyLineInsertions bool `json:"skipEmptyLineInsertions"` | ||
} | ||
|
||
type GaugeSettings struct { | ||
Format FormatConfig `json:"formatting"` | ||
} | ||
|
||
type Settings struct { | ||
Gauge GaugeSettings `json:"gauge"` | ||
} | ||
|
||
type DidChangeConfigurationParams struct { | ||
Settings Settings `json:"settings"` | ||
} | ||
|
||
func UpdateSettings(request *jsonrpc2.Request) error { | ||
var params DidChangeConfigurationParams | ||
if err := json.Unmarshal(*request.Params, ¶ms); err != nil { | ||
return err | ||
} | ||
SetGaugeSettings(params.Settings.Gauge) | ||
return nil | ||
} | ||
|
||
func SetGaugeSettings(gs GaugeSettings) { | ||
currentSettings = gs | ||
} | ||
|
||
func CurrentGaugeSettings() GaugeSettings { | ||
return currentSettings | ||
} | ||
|
||
func SetSkipEmptyLineInsertions(val bool) { | ||
currentSettings.Format.SkipEmptyLineInsertions = val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters