Golang language server - SkorikSergey/Language-servers-test-plan GitHub Wiki

Preconditions:

  1. Create workspace from the Go stack with desktop-go-simple project.
  2. Enable Golang language server in the Installers tab and start the workspace.
  3. Create "format.go" file with content:
package
main

import (

	   "fmt"
	"math"

)

func    print(   ) {
	   fmt.Printf("Hello, world. Sqrt(2) = %v\n",  math.Sqrt(2))
}

  1. Create "main.go" file with content:

package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Printf("Hello, world. Sqrt(2) = %v\n", math.Sqrt(2))
}

  1. Create "print.go" file with content:
package main

import (
	"fmt"
)

const COLOR_RED = "\x1b[31;1m "
const COLOR_GREEN = "\x1b[32;1m "
const COLOR_YELLOW = "\x1b[33;1m "
const COLOR_BLACK = "\x1b[34;1m "

func Print(color string, s string) {
	fmt.Printf("%s %s\n", color, s)
}

  1. Create "towers.go" file with content:
package main

import (
	"fmt"
)

var count int

func hanoi(n int, a, b, c string) {
	if n == 1 {
		count++
		Print(COLOR_GREEN, fmt.Sprintf("Step %d: move disk from %s to %s\n", count, a, c))
		return
	}

	hanoi(n-1, a, c, b)
	count++
	Print(COLOR_YELLOW, fmt.Sprintf("Step %d: move disk from %s to %s\n", count, a, c))
	hanoi(n-1, b, a, c)
}

func main() {
	hanoi(3, "1", "2", "3")
}

Testing process

  • Language server initialization
  1. From the project open "main.go" file.
  2. Check Finished running tool: /usr/local/go/bin/go build message in the dev-machine console.
  • Autocomplete feature
  1. Open "main.go" file.
  2. Create a new line on line 10.
  3. Add fmt.P code and launch autocomplete by Ctrl+Space.
  4. Check that proposal Printfis present.
  5. Delete created line.
  • Find definition feature
  1. Open "towers.go" file.
  2. Set cursor to 12:5 position and invoke Assistant -> Find Definition. The "print.go" file should be opened and function Print should be selected.
  3. Close the print.go file. And repeat previous step using F4 key instead of Assistant -> Find Definition invocation.
  • Code validation feature, Comment line
  1. Open "main.go" file.
  2. Move cursor in 1:1 position.
  3. Type p symbol there and check that error marker is appeared. Click on error marker - the proposal widget should be show expected 'package', found 'IDENT' ppackage message.
  4. Restore content. Error marker should disappear.
  5. Move cursor in line 1 position and comment this line by Ctrl+/ buttons.
  6. Check that text in line 3 was changed from package main to //package main.
  7. Uncomment this line by Ctrl+/ buttons.
  • Hover feature
  1. Open "towers.go" file.
  2. Move mouse pointer on position 12:15
  3. Wait hover popup is appeared with text const COLOR_YELLOW string = "\x1b[33;1m ".
  4. Move mouse pointer on position 22:8
  5. Wait hover popup is appeared with text main redeclared in this block previous declaration at.
  • Format code feature
  1. Open "format.go" file.
  2. Start Format option from context menu;
  3. Check that the file content was changed to:
package main

import (
	"fmt"
	"math"
)

func print() {
	fmt.Printf("Hello, world. Sqrt(2) = %v\n", math.Sqrt(2))
}

Rename

  1. Open "towers.py" file.
  2. Select "n" variable in line 10.
  3. Start Rename feature by Shift+F6 or from Assistant menu.
  4. Type new variable name.
  5. Check that the variable name was changed.

Find References

  1. Open "towers.py" file.
  2. Select count variable
  3. Start Find References feature by pressing Alt+F7 buttons or from Assistant menu.
  4. Check that Find References panel is opened with /desktop-go-simple/towers.go From:7:5 To:7:10 result in it.

Signature Help

  1. Open "towers.go" file.
  2. Type hanoi on line 24.
  3. Type '(' symbol and wait for hover popup with hanoi(n int, a, b, c string) text.
  4. Delete added line.

Go To Symbol

  1. Open "towers.go" file.
  2. Start Go To Symbol feature by Ctrl+F12 buttons or from Assistant menu.
  3. Wait for Go To Symbol form is opened with next lines:
main symbols(4)
count
hanoi
main
  1. Click on any of them and check that it correctly selected in file.

Find Project Symbol

  1. Open "towers.go" file.
  2. Start Find Project Symbol feature by Alt+N buttons or from Assistant menu.
  3. Type Print in Find Project Symbol form input.
  4. Wait for Print /desktop-go-simple/print.go line.
  5. Type hanoi in Find Project Symbol form input.
  6. Wait for hanoi /desktop-go-simple/towers.go line.
  7. Click on any of them and check that it correctly selected in file.