-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add the option to enable unnecessaryParenthesesAnalyzer
#79
Comments
@cannorin I'd be willing to take this on with some pointers on where to get started. I peaked through the source a bit, and it seems that code actions are entirely delegated to the LSP client and the language server. I see where the default settings are defined in autoload/fsharp.vim, but grepping the code base for existing lints and code actions yields nothing. Is this something that would need to be configured in the tools' own configs (fsautocomplete or fsharplint)? |
@greggyb in the general case what you need is a way for users to set some config settings and have those applied to the LSP settings that are sent to the LSP. This sending happens in two places:
What we've done in Ionide for VsCode is add all of the settings for FSAC to settings for the VSCode extension, and when a user edits these at all then the editor handles sending the necessary |
So I've got a one-line change that will add this specific setting. We've got some divergence between the options in Ionide-vim and fsautocomplete. Lists below. Anything that is a primitive or primitive collection seems straightforward to add, here. I'd have to dig further to see what it would take to reasonably serialize some of these other types in a Vim data structure. All it takes to add support for the option is to add an entry to the array @cannorin , would you prefer a one-liner change for a PR, or would it be better to add all of these options in one go? Supported in FsAutocomplete ( { AutomaticWorkspaceInit: bool option
WorkspaceModePeekDeepLevel: int option
ExcludeProjectDirectories: string array option
KeywordsAutocomplete: bool option
ExternalAutocomplete: bool option
FullNameExternalAutocomplete: bool option
Linter: bool option
LinterConfig: string option
IndentationSize: int option
UnionCaseStubGeneration: bool option
UnionCaseStubGenerationBody: string option
RecordStubGeneration: bool option
RecordStubGenerationBody: string option
InterfaceStubGeneration: bool option
InterfaceStubGenerationObjectIdentifier: string option
InterfaceStubGenerationMethodBody: string option
AddPrivateAccessModifier: bool option
UnusedOpensAnalyzer: bool option
UnusedOpensAnalyzerExclusions: string array option
UnusedDeclarationsAnalyzer: bool option
UnusedDeclarationsAnalyzerExclusions: string array option
SimplifyNameAnalyzer: bool option
SimplifyNameAnalyzerExclusions: string array option
UnnecessaryParenthesesAnalyzer: bool option
ResolveNamespaces: bool option
EnableReferenceCodeLens: bool option
EnableAnalyzers: bool option
AnalyzersPath: string array option
ExcludeAnalyzers: string array option
IncludeAnalyzers: string array option
DisableInMemoryProjectReferences: bool option
LineLens: LineLensConfig option
UseSdkScripts: bool option
DotNetRoot: string option
FSIExtraParameters: string array option
FSICompilerToolLocations: string array option
TooltipMode: string option
GenerateBinlog: bool option
AbstractClassStubGeneration: bool option
AbstractClassStubGenerationObjectIdentifier: string option
AbstractClassStubGenerationMethodBody: string option
CodeLenses: CodeLensConfigDto option
PipelineHints: InlineValueDto option
InlayHints: InlayHintDto option
Fsac: FSACDto option
Notifications: NotificationsDto option
Debug: DebugDto option } Supported in Ionide-vim (from autoload/fsharp.vim). 26 lines of options (including my added line for the unnecessary parentheses option, so 25 before adding this): let s:config_keys_camel =
\ [
\ {'key': 'AutomaticWorkspaceInit', 'default': 1},
\ {'key': 'WorkspaceModePeekDeepLevel', 'default': 2},
\ {'key': 'ExcludeProjectDirectories', 'default': []},
\ {'key': 'keywordsAutocomplete', 'default': 1},
\ {'key': 'ExternalAutocomplete', 'default': 0},
\ {'key': 'Linter', 'default': 1},
\ {'key': 'UnionCaseStubGeneration', 'default': 1},
\ {'key': 'UnionCaseStubGenerationBody'},
\ {'key': 'RecordStubGeneration', 'default': 1},
\ {'key': 'RecordStubGenerationBody'},
\ {'key': 'InterfaceStubGeneration', 'default': 1},
\ {'key': 'InterfaceStubGenerationObjectIdentifier', 'default': 'this'},
\ {'key': 'InterfaceStubGenerationMethodBody'},
\ {'key': 'UnusedOpensAnalyzer', 'default': 1},
\ {'key': 'UnusedDeclarationsAnalyzer', 'default': 1},
\ {'key': 'SimplifyNameAnalyzer', 'default': 0},
\ {'key': 'ResolveNamespaces', 'default': 1},
\ {'key': 'EnableReferenceCodeLens', 'default': 1},
\ {'key': 'EnableAnalyzers', 'default': 0},
\ {'key': 'AnalyzersPath'},
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
\ {'key': 'LineLens', 'default': {'enabled': 'never', 'prefix': ''}},
\ {'key': 'UseSdkScripts', 'default': 1},
\ {'key': 'dotNetRoot'},
\ {'key': 'fsiExtraParameters', 'default': []},
\ {'key': 'UnnecessaryParenthesesAnalyzer', 'default': 1}, |
@greggyb I would really appreciate it if you could add the missing options which are straightforward to add (i.e. primitive or primitive collection). I'll take care of the harder ones :) |
Options taken from ionide/FsAutoComplete project, specifically src/FsAutoComplete/LspHelpers.fs: - names from `FSharpConfigDto` - default values from `FSharpConfig.Default` Brought over all that were primitives or primitive collections and included commented TODO items for non-primitive options. implements ionide#79
@greggyb Thank you! |
Is your feature request related to a problem? Please describe.
FsAutocomplete added a setting
unnecessaryParenthesesAnalyzer
two months ago. It would be nice to be able to enable this setting. ionide/FsAutoComplete#1235Describe the solution you'd like
The optimal solution would be to add all settings the VSCode has. I would lie if I said that I've gone through all settings to check which are missing so it just might be this setting that is missing.
Describe alternatives you've considered
I would be fine with just adding
unnecessaryParenthesesAnalyzer
. Or, is there a workaround that I can do in my Neovim settings to enable me to set this setting in another way?Additional context
The text was updated successfully, but these errors were encountered: