-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-50) Add document formatter for puppet-lint
Previously the vscode extension ran puppet-lint locally for fix linting issues, however with the language server this feature was lost. This commit adds the document formatting feature back into the vscode extension; * Uses the puppet-lint --fix feature to actually apply the fixes * Adds a custom command to the language protocol puppet/fixDiagnosticErrors which will return a 'fixed' document and the number of fixes applied * Adds an additional configuration option puppet.format.enable which will disable document formatting.
- Loading branch information
1 parent
a8f72de
commit d2ecd7d
Showing
5 changed files
with
187 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module LanguageServer | ||
module PuppetFixDiagnosticErrorsRequest | ||
# export interface PuppetFixDiagnosticErrorsRequestParams { | ||
# documentUri: string; | ||
# alwaysReturnContent: boolean; | ||
# } | ||
|
||
def self.create(options) | ||
result = { | ||
'alwaysReturnContent' => false | ||
} | ||
raise('documentUri is a required field for PuppetFixDiagnosticErrorsRequest') if options['documentUri'].nil? | ||
|
||
result['documentUri'] = options['documentUri'] | ||
result['alwaysReturnContent'] = options['alwaysReturnContent'] unless options['alwaysReturnContent'].nil? | ||
result | ||
end | ||
end | ||
|
||
module PuppetFixDiagnosticErrorsResponse | ||
# export interface PuppetFixDiagnosticErrorsResponse { | ||
# documentUri: string; | ||
# fixesApplied: number; | ||
# newContent?: string; | ||
# } | ||
|
||
def self.create(options) | ||
result = {} | ||
raise('documentUri is a required field for PuppetFixDiagnosticErrorsResponse') if options['documentUri'].nil? | ||
raise('fixesApplied is a required field for PuppetFixDiagnosticErrorsResponse') if options['fixesApplied'].nil? | ||
|
||
result['documentUri'] = options['documentUri'] | ||
result['fixesApplied'] = options['fixesApplied'] | ||
result['newContent'] = options['newContent'] unless options['newContent'].nil? | ||
|
||
result | ||
end | ||
end | ||
end |
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