The FsAutoComplete project (FSAC) provides a backend service for rich editing or intellisense features for editors.
It can be hosted using the Language Server Protocol.
Currently, it is used by the following extensions:
And it can be used with the following editors, by simply installing FsAutoComplete directly:
dotnet tool install --global fsautocomplete
It is based on:
- FSharp.Compiler.Service for F# language info.
- Ionide.ProjInfo for project/solution management.
- FSharpLint for the linter feature.
- Fantomas for F# code formatting.
Requirements:
- .NET SDK, see global.json for the exact version. Minimum: >= 6.0, Recommended: >= 7.0
- Restore dotnet tools to install local Paket
dotnet tool restore - Build FSAC with
dotnet build
The repository additionally provides DevContainer definition that can be used with VSCode's Remote Containers extension - use it to get stable development environment
This repository is prepared to use Gitpod for a web-based VSCode-style IDE. Click the button below to begin!
Checkout this guide to start with a new code fix.
- Update CHANGELOG.md with the release notes from the current release in the
Unreleasedsection. Use section headings likeAdded,Fixed, etc from keepachangelog.com. - For individual section items in the Changelog, use headings like
BUGFIX,FEATURE, andENHANCEMENTfollowed by a link to the PR with the PR title. - Run the
PromoteFAKE target via thePromotetarget to create the appropriate release version from the currentUnreleasedsection and stamp the date, as well as create a commit and tag for this promotion - push this commit and tag to main
- the CI pipeline will publish a release from the tag.
FsAutocomplete is using System.Diagnostics.Activity to create traces.
To export traces, run Jaeger
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=9411 \
-e COLLECTOR_OTLP_ENABLED=true \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 14250:14250 \
-p 14268:14268 \
-p 14269:14269 \
-p 9411:9411 \
jaegertracing/all-in-one:latestThen configure your environment
OTEL_EXPORTER_OTLP_ENDPOINT = "http://localhost:4317"Start FsAutocomplete by dotnet fsautocomplete --otel-exporter-enabled.
Or by code . with setting "FSharp.fsac.fsacArgs": ["--otel-exporter-enabled"].
(If you also want to observe fsc traces, use the FSharp.notifications settings.)
Do some actions like opening documents, saving, getting tooltips, etc.
Then open http://localhost:16686/ to inspect traces.
FsAutoComplete supports LSP as a communication protocol.
initializetextDocument/didOpentextDocument/didChangetextDocument/didSavetextDocument/hovertextDocument/completion&completionItem/resolvetextDocument/renametextDocument/definitiontextDocument/typeDefinitiontextDocument/implementationtextDocument/codeAction:- Remove unused
open - Resolve namespace/module
- Replace unused symbol with
_ - Fix typo based on error message
- Remove redundant qualifier
- Add missing
newkeyword forIDisposable - Generate cases for all DU case in pattern matching
- Generate empty interface implementation
- Fixes suggested by FSharpLint
- Remove unused
textDocument/codeLens&codeLens/resolve:- signature Code Lenses
- reference number Code Lenses
textDocument/formatting- powered by fantomastextDocument/referencestextDocument/documentHighlighttextDocument/signatureHelptextDocument/documentSymboltextDocument/inlayHinttextDocument/inlineValueworkspace/didChangeWatchedFilesworkspace/didChangeConfigurationworkspace/symbol
Custom endpoints are using (for messages body) PlainNotification type and string format serialized with exactly same serialization format as old JSON protocol
fsharp/signature- acceptsTextDocumentPositionParams, returns signature of symbol at given position as a formatted stringfsharp/signatureData- acceptsTextDocumentPositionParams, returns signature of symbol at given position as DTOfsharp/lineLens- acceptsProjectParms(Projectfiled contain F# file path), returns locations where LineLenses should be displayedfsharp/compilerLocation- no input, returns paths to FCS, FSI and MsBuildfsharp/compile- acceptsProjectParms, tries to compile project, returns list of errors and exit status codefsharp/workspacePeek- acceptsWorkspacePeekRequest, returns list of possible workspaces (resolved solution files, or list of projects if there are no solution files)fsharp/workspaceLoad- acceptsWorkspaceLoadParms, loads given list of projects in the background, partial result notified byfsharp/notifyWorkspacenotificationfsharp/project- acceptsProjectParms, loads given projectfsharp/fsdn- acceptsProjectParms(Projectfiled contain query string), query FSDN and returns list of functionsfsharp/f1Help- acceptsTextDocumentPositionParams, returns URL to MSDN documentation for symbol at given positionfsharp/documentation- acceptsTextDocumentPositionParams, returns documentation data about symbol at given position, used for InfoPanelfsharp/documentationSymbol- acceptsDocumentationForSymbolReuqest, returns documentation data about given symbol from given assembly, used for InfoPanelfsproj/moveFileUp- acceptsDotnetFileRequest, move the file down of 1 line in the project filefsproj/moveFileDown- acceptsDotnetFileRequest, move the file up of 1 line in the project filefsproj/addFileAbove- acceptsDotnetFile2Request, create the file if needed and add it above the reference file in the project if not already presentfsproj/addFileBelow- acceptsDotnetFile2Request, create the file if needed and add it below the reference file in the project if not already presentfsproj/addFile- acceptsDotnetFileRequest, create the file if needed and add it to the project if not already presentfsproj/addExistingFile- acceptsDotnetFileRequest, add existing file to a project if not already presentfsproj/removeFile- acceptsDotnetFileRequest, remove the file from the projectfsproj/renameFile- acceptsDotnetRenameFileRequest, rename the file from the project
window/showMessagewindow/logMessagetextDocument/publishDiagnostics
fsharp/notifyWorkspace- notification for workspace/solution/project loading eventsfsharp/notifyWorkspacePeek- notification for initial workspace peek
--state-directory dir- a workspace-specific directory for keeping language server states.--verbose- passing this flag enables additional logging being printed out instderrDOTNET_ROOT- setting this environment variable will set the dotnet SDK root, which is used when finding references for FSX scripts.
Options that should be send as initializationOptions as part of initialize request.
AutomaticWorkspaceInit- setting it totruewill start Workspace Loading without need to runfsharp/workspacePeekandfsharp/workspaceLoadcommands. It will always choose top workspace from the found list - all projects in workspace if 0.slnfiles are found,.slnfile if 1.slnfile was found,.slnfile with most projects if multiple.slnfiles were found. It's designed to be used in clients that doesn't allow to create custom UI for selecting workspaces.
FSharp.keywordsAutocomplete- provides keywords in autocomplete list, recommended default value:trueFSharp.ExternalAutocomplete- provides autocomplete for symbols from not opened namespaces/modules, insertopenon accept, recommended default value:falseFSharp.Linter- enables FSharpLint integration, provides additional warnings and code action fixes, recommended default value:trueFSharp.UnionCaseStubGeneration- enables code action to generate pattern matching cases, recommended default value:trueFSharp.UnionCaseStubGenerationBody- defines dummy body used by pattern matching generator, recommended default value:"failwith \"Not Implemented\""FSharp.RecordStubGeneration- enables code action to generate record stub, recommended default value:trueFSharp.RecordStubGenerationBody- defines dummy body used by record stub generator, recommended default value:"failwith \"Not Implemented\""FSharp.InterfaceStubGeneration- enables code action to generate interface stub, recommended default value:trueFSharp.InterfaceStubGenerationObjectIdentifier- defines object identifier used by interface stub generator,recommended default value:"this"FSharp.InterfaceStubGenerationMethodBody- defines dummy body used by interface stub generator, recommended default value:"failwith \"Not Implemented\""FSharp.UnusedOpensAnalyzer- enables unusedopendetections, recommended default value:trueFSharp.UnusedDeclarationsAnalyzer- enables unused symbol detection, recommended default value:trueFSharp.UseSdkScripts- enables the use of .Net Core SDKs for script file type-checking and evaluation, otherwise the .Net Framework reference lists will be used. Recommended default value:true. Current default value:trueFSharp.SimplifyNameAnalyzer- enables simplify name analyzer and remove redundant qualifier quick fix, recommended default value:falseFSharp.ResolveNamespaces- enables resolve namespace quick fix (addopenif symbol is from not yet opened module/namespace), recommended default value:trueFSharp.EnableReferenceCodeLens- enables reference count code lenses, recommended default value:trueif--background-service-enabledis used by default,falseotherwiseFSharp.dotNetRoot- sets the root path for finding dotnet SDK references. Primarily used for FSX Scripts. Default value: operating-system dependent. On windows,C:\Program Files\dotnet; on Unix,/usr/local/share/dotnet- Extra parameters for FSI: use only
FSharp.FSIExtraParameterson its own or a combination ofFSharp.FSIExtraInteractiveParametersandFSharp.FSIExtraSharedParameters. The former is expected to be deprecated in favor of the second two. See #1210 for more detail. FSAC will send a warning if you mix usage improperly.-
FSharp.FSIExtraParameters- an array of additional runtime arguments that are passed to FSI. These are used when typechecking scripts to ensure that typechecking has the same context as your FSI instances. An example would be to set the following parameters to enable Preview features (like opening static classes) for typechecking. -
FSharp.FSIExtraInteractiveParameters- currently unused by FSAC, but available to editor plugins for interactivedotnet fsiparameters that are not shared by the compiler. Future intentions are to manage the interpreter from FSAC, at which point FSAC will utilize this parameter. Check this reference for parameters that are interactive-only or shared with the compiler. -
FSharp.FSIExtraSharedParameters- an array of additional runtime arguments that are passed to FSI; specifically parameters that are shared with the compiler. These are used when typechecking scripts to ensure that typechecking has the same context as your FSI instances. An example would be to set the following parameters to enable Preview features (like opening static classes) for typechecking. Check this reference for parameters that are interactive-only or shared with the compiler."FSharp.fsiExtraSharedParameters": ["--langversion:preview"] "FSharp.fsiExtraInteractiveParameters": ["--readline-"]
-
You may see a stack trace finishing with System.IO.IOException: kqueue() error at init, error code = ’0’. This is due to a limitation in the number of file handles that the Mono file watchers can keep open. Restarting FsAutoComplete or the hosting editor should help. If not, try setting export MONO_MANAGED_WATCHER=disabled in your ~/.bash_profile. Note that on OSX, this setting will only take effect if you launch emacs from the terminal.
The maintainers of this repository are:
Previous maintainers: