Skip to content

Commit

Permalink
Merge pull request #617 from 4ever2/fix-topfile-arg
Browse files Browse the repository at this point in the history
[VsCoq1] Fix #278: pass correct `-topfile` argument
  • Loading branch information
thery committed Sep 13, 2023
2 parents e759426 + 3118fbb commit 5a5a341
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@
"vscode-jsonrpc": "^4.0.0",
"vscode-languageclient": "^5.2.1",
"vscode-languageserver": "^5.2.1",
"vscode-uri": "3.0.7",
"ws": "^7.4.6"
}
}
18 changes: 14 additions & 4 deletions server/src/coqtop/CoqTop8.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import { URI } from 'vscode-uri'
import * as net from 'net';
import * as path from 'path';
import * as vscode from 'vscode-languageserver';
Expand All @@ -24,15 +25,15 @@ export class CoqTop extends IdeSlave8 implements coqtop.CoqTop {
private coqtopProc : ChildProcess = null;
private readyToListen: Thenable<void>[];
private settings : CoqTopSettings;
private scriptFile : string;
private scriptUri : string;
private projectRoot: string;
private coqtopVersion : semver.SemVer;
private sockets : net.Socket[] = [];

constructor(settings : CoqTopSettings, scriptFile: string, projectRoot: string, console: vscode.RemoteConsole) {
super(console);
this.settings = settings;
this.scriptFile = scriptFile;
this.scriptUri = scriptFile;
this.projectRoot = projectRoot;
this.mainChannelServer = net.createServer();
this.mainChannelServer2 = net.createServer();
Expand Down Expand Up @@ -210,10 +211,19 @@ export class CoqTop extends IdeSlave8 implements coqtop.CoqTop {
return path.join(this.settings.binPath.trim(), this.settings.coqidetopExe);
}

private get scriptPath() {
let uri = URI.parse(this.scriptUri)
if (uri.scheme == "file")
return uri.fsPath;
else
return undefined
}

private spawnCoqTop(mainAddr : string, controlAddr: string) {
var topfile : string[] = [];
if (semver.satisfies(this.coqtopVersion, ">= 8.10")) {
topfile = ['-topfile', this.scriptFile];
var scriptPath = this.scriptPath;
if (semver.satisfies(this.coqtopVersion, ">= 8.10") && scriptPath !== undefined) {
topfile = ['-topfile', scriptPath];
}
if (semver.satisfies(this.coqtopVersion, ">= 8.9")) {
var coqtopModule = this.coqidetopBin;
Expand Down

0 comments on commit 5a5a341

Please sign in to comment.