Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VsCoq1] Fix #278: pass correct -topfile argument #617

Merged
merged 1 commit into from
Sep 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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