1. Help Center
  2. Getting Started
  3. Getting Started With Diarkis Server Development

How to enable code completion

This article explains how to use code completion in server-side development.

Condition

In this article, we will start the explanation from the state where the project is deployed from the project template.

For more information about project deployment using project templates, please refer to "Introduction To Diarkis Server Template" and "Diarkis Server Template Directories".

Get a code reference for code completion

Get the archive with the same name as the Diarkis version you want to use.

https://docs.diarkis.io/sdk/server_coderef/current.tar.gz

current.tar.gz is a link to the latest version.
If you want to use old version, "current" to "v0.x.x" in URL.

After download it, extract it to an arbitrary location.

Referencing the code reference from the project

Add the following statement to go.mod, you can refer to the code reference from the code completion function of editor/IDE.

replace github.com/Diarkis/diarkis => /path/to/downloaed/coderef

Path should be the location where the code referece will be extracted.

What is "replace" directive

This is a directive that replaces the content (reference) of the module specified by import.

See also : https://go.dev/ref/mod#go-mod-file-replace

Notes

The replace directive in go.mod (replace github.com/Diarkis/diarkis) is ignored when building with diarkis-cli, so there is no need to remove when you want to build project.