Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions client/src/commands/lspCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import { LanguageClient } from 'vscode-languageclient/node'
import { EventEmitter } from 'events'
import * as jobs from '../protocol/requests'

/**
* Request that the server should disconnect. Returns promise that will resolve when the server has been reconnected.
* Used for testing purposes.
*/
export function simulateDisconnect(client: LanguageClient) {
return () => client.sendNotification(jobs.Request.apiDisconnect)
}

export function makeHandleRunJob(client: LanguageClient, request: jobs.Request) {
return function handler() {
client.sendNotification(request)
Expand Down
3 changes: 1 addition & 2 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { setupProjectWatchers, setupSingleFileTracking, disposeWatchers } from '
import { startSession } from './lsp/session'
import { getUserConfiguration, getCheckCount } from './lsp/notifications'

import { simulateDisconnect, showAst, allJobsFinished } from './commands/lspCommands'
import { showAst, allJobsFinished } from './commands/lspCommands'
import {
runMain,
cmdInit,
Expand Down Expand Up @@ -114,7 +114,6 @@ export async function activate(context: vscode.ExtensionContext, launchOptions:
// Register commands for command palette
registerCommand('flix.internalRestart', makeHandleRestartClient(context, { shouldUpdateFlix: false }))
registerCommand('flix.internalDownloadLatest', makeHandleRestartClient(context, { shouldUpdateFlix: true }))
registerCommand('flix.simulateDisconnect', simulateDisconnect(client))
registerCommand('flix.runMain', runMain(context, launchOptions))

registerCommand('flix.cmdInit', cmdInit(context, launchOptions))
Expand Down
1 change: 0 additions & 1 deletion client/src/protocol/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export enum Request {
apiRemJar = 'api/remJar',
apiVersion = 'api/version',
apiShutdown = 'api/shutdown',
apiDisconnect = 'api/disconnect',

lspCheck = 'lsp/check',
lspCodelens = 'lsp/codelens',
Expand Down
1 change: 0 additions & 1 deletion server/src/engine/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export enum Request {
apiRemJar = 'api/remJar',
apiVersion = 'api/version',
apiShutdown = 'api/shutdown',
apiDisconnect = 'api/disconnect',

lspCheck = 'lsp/check',
lspCodelens = 'lsp/codelens',
Expand Down
9 changes: 0 additions & 9 deletions server/src/handlers/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ export function handleExit() {
engine.stop()
}

/**
* Simulates the compiler disconnecting.
* Used for testing.
*/
export function handleDisconnect() {
const expectResponse = false
socket.sendMessage({ id: 'disconnect', request: jobs.Request.apiDisconnect }, expectResponse)
}

/**
* Request a response to be sent when all jobs are finished.
*/
Expand Down
2 changes: 0 additions & 2 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ connection.onInitialize(handlers.handleInitialize)
// The user has changed something in the configuration
connection.onNotification(jobs.Request.internalReplaceConfiguration, handlers.handleReplaceConfiguration)

connection.onNotification(jobs.Request.apiDisconnect, handlers.handleDisconnect)

// Event happens once after either startup or a restart - starts the engine
connection.onNotification(jobs.Request.internalReady, handlers.handleReady)

Expand Down
41 changes: 0 additions & 41 deletions test/src/disconnect.test.ts

This file was deleted.

20 changes: 1 addition & 19 deletions test/src/implementation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as assert from 'assert'
import * as vscode from 'vscode'
import { getTestDocUri, init, normalizeLocation } from './util'
import { getTestDocUri, init } from './util'

suite('ImplementationProvider', () => {
const dividableDocUri = getTestDocUri('src/Dividable.flix')
Expand All @@ -34,22 +34,4 @@ suite('ImplementationProvider', () => {
)
assert.deepStrictEqual(r, [])
})

async function testImplementations(uri: vscode.Uri, position: vscode.Position, expectedLocations: vscode.Location[]) {
const r = await vscode.commands.executeCommand<(vscode.Location | vscode.LocationLink)[]>(
'vscode.executeImplementationProvider',
uri,
position,
)

const actualLocations = r.map(normalizeLocation)

assert.deepStrictEqual(new Set(actualLocations), new Set(expectedLocations))
}

test.skip('Should find Dividable trait implementation', async () => {
await testImplementations(dividableDocUri, new vscode.Position(1, 6), [
new vscode.Location(dividableDocUri, new vscode.Range(5, 9, 5, 18)),
])
})
})
12 changes: 0 additions & 12 deletions test/src/rename.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ suite('RenameProvider', () => {
assert.strictEqual(ranges.length, 2)
})

test.skip('Should rename function', async () => {
const position = await findMarkerPosition(mainDocUri, 'area1')
const ranges = await testRename(mainDocUri, position)
assert.strictEqual(ranges.length, 2)
})

test.skip('Should rename function-use', async () => {
const position = await findMarkerPosition(mainDocUri, 'area2')
const ranges = await testRename(mainDocUri, position)
assert.strictEqual(ranges.length, 2)
})

async function testRename(uri: vscode.Uri, position: vscode.Position): Promise<vscode.Range[]> {
await open(uri)
const newName = 'NewName'
Expand Down
6 changes: 0 additions & 6 deletions test/testWorkspaces/disconnect/flix.toml

This file was deleted.

13 changes: 0 additions & 13 deletions test/testWorkspaces/disconnect/src/Area.flix

This file was deleted.

3 changes: 0 additions & 3 deletions test/testWorkspaces/disconnect/src/Assert.flix

This file was deleted.

11 changes: 0 additions & 11 deletions test/testWorkspaces/disconnect/src/Main.flix

This file was deleted.

4 changes: 2 additions & 2 deletions test/testWorkspaces/rename/src/Main.flix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ enum Shape {

/// Computes the area of the given shape using
/// pattern matching and basic arithmetic.
def area /*!area1*/(s /*!s1*/: Shape): Int32 = match s /*!s2*/ {
def area(s /*!s1*/: Shape): Int32 = match s /*!s2*/ {
case Shape.Circle(r) => 3 * (r * r)
case Shape.Square(w) => w * w
case Shape.Rectangle(h, w) => h * w
}

// Computes the area of a 2 by 4.
def main(): Unit \ IO =
println(area /*!area2*/(Shape.Rectangle(2, 4)))
println(area(Shape.Rectangle(2, 4)))
Loading