Skip to content

Commit

Permalink
Rename server commands to services
Browse files Browse the repository at this point in the history
The concept of command is more attached to the client, the server will just 'serve' a request from the client.
  • Loading branch information
davelopez committed Jun 1, 2022
1 parent f5a1f11 commit 0824d7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TextDocuments,
WorkspaceFolder,
} from "vscode-languageserver";
import { CleanWorkflowCommand } from "./commands/cleanWorkflow";
import { CleanWorkflowService } from "./services/cleanWorkflow";
import { WorkflowLanguageService, TextDocument, WorkflowDocument } from "./languageTypes";
import { WorkflowDocuments } from "./models/workflowDocuments";
import { SymbolsProvider } from "./providers/symbolsProvider";
Expand All @@ -33,7 +33,7 @@ export class GalaxyWorkflowLanguageServer {

this.registerProviders();

this.registerCommands();
this.registerServices();

this.connection.onShutdown(() => this.cleanup());
}
Expand Down Expand Up @@ -70,8 +70,8 @@ export class GalaxyWorkflowLanguageServer {
CompletionProvider.register(this);
}

private registerCommands(): void {
CleanWorkflowCommand.register(this);
private registerServices(): void {
CleanWorkflowService.register(this);
}

private trackDocumentChanges(connection: Connection): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApplyWorkspaceEditParams, Range, TextDocumentEdit, TextEdit } from "vsc
import { TextDocument } from "vscode-languageserver-textdocument";
import { ASTNode, PropertyASTNode, WorkflowDocument } from "../languageTypes";
import { GalaxyWorkflowLanguageServer } from "../server";
import { CustomCommand } from "./common";
import { ServiceBase } from "./common";
import {
CleanWorkflowContentsParams,
CleanWorkflowContentsRequest,
Expand All @@ -13,15 +13,15 @@ import {
} from "./requestsDefinitions";

/**
* Command for handling workflow `cleaning` requests.
* Service for handling workflow `cleaning` requests.
* Supports both, direct contents (raw document text), and document uri requests
* for cleaning.
* When requesting with a document uri, the workflow document must be already registered in the server
* as a workflow document.
*/
export class CleanWorkflowCommand extends CustomCommand {
public static register(server: GalaxyWorkflowLanguageServer): CleanWorkflowCommand {
return new CleanWorkflowCommand(server);
export class CleanWorkflowService extends ServiceBase {
public static register(server: GalaxyWorkflowLanguageServer): CleanWorkflowService {
return new CleanWorkflowService(server);
}

constructor(server: GalaxyWorkflowLanguageServer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ServerContext } from "../languageTypes";
import { GalaxyWorkflowLanguageServer } from "../server";

export abstract class CustomCommand extends ServerContext {
export abstract class ServiceBase extends ServerContext {
constructor(server: GalaxyWorkflowLanguageServer) {
super(server);
this.listenToRequests();
}

/**
* This method should call `this.connection.onRequest` to register
* the proper callback for this command request.
* the proper callback for this service request.
*/
protected abstract listenToRequests(): void;
}
File renamed without changes.

0 comments on commit 0824d7c

Please sign in to comment.