Skip to content

TypedUseCase/tuc-extension

Repository files navigation

TypedUseCase - .tuc

Checks Version tuc-docs

Extension for visual studio code, which add support for TUC language.

TUC

Typed Use-Case

tuc-logo

It is basically a use case definition, for which this console application can generate PlantUML diagram, where all services are domain specific type safe.

For more information, go check tuc-console or documentation.

Tuc Extension features

Syntax Highlighting

It highlights a syntax for keywords, participants and other parts of Tuc and even most common errors.

Code Completion

It auto-complete a keywords, participants and other parts of Tuc.


How to build and test a local version of Tuc.Extension

Prerequisites

Building

Fork, from the github interface https://github.com/TypedUseCase/tuc-extension

  • if you don't use a certificate for committing to github:
git clone https://github.com/YOUR_GITHUB_USER/tuc-extension.git
  • if you use a certificate for github authentication:
git clone git@github.com:YOUR_GITHUB_USER/tuc-extension.git

First time build:

cd tuc-extension
./build.sh  # or build.cmd if your OS is Windows  (might need ./build Build here)

If dotnet restore gives the error The tools version "14.0" is unrecognized, then you need to install [msbuildtools2015][msbuildtools2015]

If dotnet restore gives the error error MSB4126: The specified solution configuration "Debug|x64" is invalid, there's a good chance you have the Platform environment variable set to "x64". Unset the variable and try the restore command again.

If ./build.sh gives errors, you may need to run ./build.sh -t Build one time.

Everything is done via build.cmd \ build.sh (for later on, lets call it just build).

  • build -t Build does a full-build, including package installation and copying some necessary files.
    It should always be done at least once after any clone/pull.
  • If a git dependency fails to build paket won't re-do it you can run their build scripts manually:
    • In paket-files\github.com\fsharp\FsAutoComplete run build LocalRelease

Launching the extension

Once the initial build on the command line is completed, you should use vscode itself to build and launch the development extension. To do this,

  • open the project folder in vscode
  • Use one of the following two configurations which will build the project and launch a new vscode instance running your vscode extension
  • In VSCode two configurations are possible to run:
    • Use Build and Launch Extension
    • Start the Watch task and when a build is done start Launch Only

These two options can be reached in VsCode in the side bar (look for a Beetle symbol), or by typing control-P Debug <space> and then selecting either Build and Launch or Watch

The new extension window will appear with window title Extension development host

Working with FSAC (Language Server)

  1. Open FSAC from a new instance of VSCode from the directory: paket-files/github.com/fsharp/FsAutoComplete
  2. Build the FSAC solution and copy the dll output from the output log, it should be something like: paket-files/github.com/fsharp/FsAutoComplete/src/FsAutoComplete/bin/Debug/netcoreapp2.1/fsautocomplete.dll. Note netcoreapp2.1 may be a different version.
  3. In the instance of VSCode that you have Tuc.Extension open, open settings (CMD , or Ctrl ,), and find the section FSharp > Fsac: Net Core Dll Path and paste the output you copied from step 3.
  4. Now find the section FSharp > Fsac: Attach Debugger and check the check box.
  5. Close settings
  6. Goto the debug section and hit Build and Launch extension, after a while another instance of VSCode will start, you can use this instance to test Tuc.Extension/FsAutoComplete.
  7. To attach the debugger go back to the instance of VSCode where you open FSAC and goto the debug section, hit .NET Core Attach in the list shown you should see all the dotnet processes running, choose one that has fsautocomplete.dll --mode lsp --attachdebugger shown.
  8. Now you will be able to use breakpoints in the FsAutocomplete solution to debug the instance from step 6.

There is a video here that goes through the steps and fixing a bug in a little more detail.

Remove the settings from steps 3 and 4 to go back to FSAC bundled in Tuc extension.

Release process

Manual

  • use ./build.sh -t releaseLocal if you want to commit/tag/create a release on github by yourself and just want to publish the extension

Automatic

this might not currently work as expected

  • simply add new version in CHANGELOG.md with today's date
  • run ./build.sh -t release (which will commit all changes and even tag current version, etc.)

Dependencies