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

LSP Server Support #58

Open
wants to merge 50 commits into
base: mathpoly
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
781e276
Export webmain to use from typescript
b-studios Feb 28, 2019
359c853
Export more information about labels
b-studios Feb 28, 2019
3e47972
Backport null
b-studios Feb 28, 2019
a7df281
Strip down processing
b-studios Feb 28, 2019
deb8cde
Log warnings in analyze mode
b-studios Mar 5, 2019
5837a88
Allow block extraction in public interface
b-studios Mar 7, 2019
7e3a36b
Add comment
b-studios Mar 7, 2019
dc2841c
Also annotate range information on blocks
b-studios Mar 7, 2019
8e1607c
Fix some copy&paste errors
b-studios Mar 7, 2019
92781d5
Also export ranges of blocks
b-studios Mar 7, 2019
f358e3a
Move LSP api to a separate koka-file
b-studios Mar 8, 2019
6777d34
Move processContent to api
b-studios Mar 8, 2019
7f5a2bc
Fix whitespaces :lipstick:
b-studios Mar 8, 2019
55c53d4
Revert dependency changes
b-studios Mar 8, 2019
b5d21a2
Simplify api.processContent
b-studios Mar 8, 2019
d56b958
Make processContent direct style
b-studios Mar 8, 2019
de9d174
Change signature of markdown to reuse it in API
b-studios Mar 8, 2019
a23c8bf
Write a few more aux files for static math
b-studios Mar 8, 2019
e79590e
Perform includes before running markdown
b-studios Mar 8, 2019
58f30f4
Allow skipping of includes
b-studios Mar 8, 2019
0a116d1
Merge LSP api with old public api for backwards compatability
b-studios Mar 8, 2019
efc9de1
Always provide second argument to avoid problems with trailing brackets
b-studios Mar 14, 2019
1311ab6
fix doi url handling; add acmart bib style support (showISSN etc)
daanx Nov 21, 2019
db35fcc
Merge branch 'master' into lsp
b-studios Nov 22, 2019
a632ee1
update madoko-local for node 12+
daanx Feb 6, 2020
0b9879d
update styles for TexLive1019
daanx Feb 6, 2020
793f4a2
update acmart style
daanx Feb 6, 2020
f3c82f3
update version to 1.7
daanx Feb 6, 2020
7850916
fix \Bbbk error
daanx Feb 6, 2020
b3c0e53
fix rmdirp version
daanx Feb 8, 2020
999c2bc
add support for inline math and code in tables containing `|`
daanx Feb 8, 2020
6fc6d9a
fix decipher on new nodejs
daanx Feb 8, 2020
8e9f15d
fix github login and repo listinq
daanx Feb 8, 2020
e14ee95
update log message
daanx Feb 8, 2020
59380ee
Merge branch 'master' of https://github.com/koka-lang/madoko
daanx Feb 8, 2020
f4d96a2
update version
daanx Feb 8, 2020
b2b5eda
Merge branch 'master' of https://github.com/koka-lang/madoko
daanx Feb 8, 2020
b341e21
fix table reformatting in the web UI with math/code that contains |
daanx Feb 8, 2020
3a8b3b5
update build instructions
daanx Feb 9, 2020
6680cfe
update madoko-local to have more liberal timeouts
daanx Feb 15, 2020
c13412a
enable running dvisvgm in parallel
daanx Feb 15, 2020
0f75f9f
bump to version 1.1.9
daanx Feb 15, 2020
5c877f0
allow math concurrency setting outside sandbox
daanx Feb 15, 2020
f36a7ac
update madoko local
daanx Feb 15, 2020
ee8ac1a
fix build
daanx Feb 15, 2020
572cae4
2 minute process timeout in sandbox mode
daanx Feb 15, 2020
6d582dd
update madoko local with concurrency flag
daanx Feb 15, 2020
8d9806f
add svg-bbox-exact option to speed up svg genaration by default.
daanx Feb 15, 2020
826f5c1
bump version to 1.2.0
daanx Feb 15, 2020
e6cbbf8
Merge master
b-studios Mar 1, 2020
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
90 changes: 52 additions & 38 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var webclient = path.join(web,"client");
// Then set it to the older version:
//
// > cd koka-0.6
// > git checkout v0.6.0-dev
// > git checkout v0.6.1-dev (or v0.6.x-dev)
// > npm install
//
// and build the release version:
Expand All @@ -47,11 +47,11 @@ var kokaExe = path.join(kokaDir,"out/release/koka-0.6.0-dev")
var testDir = "test";

var kokaFlags = "-i" + sourceDir + " -i" + libraryDir + " " + (process.env.kokaFlags || "");
var kokaCmd = kokaExe + " " + kokaFlags + " -c -o" + outputDir + " --outname=" + main + " "
var kokaCmd = kokaExe + " " + kokaFlags + " -c -o" + outputDir + " --outname=" + main + " "


//-----------------------------------------------------
// Tasks: compilation
// Tasks: compilation
//-----------------------------------------------------
task("default",["madoko"]);

Expand All @@ -68,7 +68,7 @@ task("madoko", [], function(cs) {
fixVersion();
var cmd = kokaCmd + " -v " + args + " " + maincli;
jake.logger.log("> " + cmd);
jake.exec(cmd, {interactive: true}, function() {
jake.exec(cmd, {interactive: true}, function() {
jake.cpR(path.join(sourceDir,"cli.js"), outputDir);
["monarch/monarch.js",
"csl/bibtex-parse.js",
Expand All @@ -79,7 +79,7 @@ task("madoko", [], function(cs) {
].forEach( function(contrib) {
jake.cpR(path.join(contribDir,contrib), outputDir);
});
complete();
complete();
})
},{async:true});

Expand Down Expand Up @@ -116,7 +116,7 @@ task("copystyles", [], function() {
});

//-----------------------------------------------------
// Tasks: clean
// Tasks: clean
//-----------------------------------------------------
desc("remove all generated files.");
task("clean", function() {
Expand All @@ -129,7 +129,7 @@ task("clean", function() {
});

//-----------------------------------------------------
// Tasks: web
// Tasks: web
//-----------------------------------------------------
desc("build web madoko")
task("web", [], function() {
Expand All @@ -142,13 +142,27 @@ task("web", [], function() {
});
},{async:true})

//-----------------------------------------------------
// Tasks: api
//-----------------------------------------------------
desc("build madoko api")
task("api", [], function() {
// fixVersion("web/client/editor.html");
var args = Array.prototype.slice.call(arguments).join(" ")
var cmd = kokaCmd + " -v -l " + args + " " + "api"
jake.logger.log("> " + cmd);
jake.exec(cmd, {interactive: true}, function(err) {
complete();
});
},{async:true})

var localTexDir = "c:/texlive/texmf-local/tex/latex/local";
desc("setup web");
task("justcopy", [], function() {
// copy all madoko sources
var js = new jake.FileList().include(path.join(outputDir,"*.js"));
copyFiles(outputDir,js.toArray(),path.join(webclient,"lib"));

// copy style, language, and image files
jake.mkdirP(path.join(webclient,path.join(styleDir,"lang")));
jake.mkdirP(path.join(webclient,path.join(styleDir,"images")));
Expand All @@ -162,17 +176,17 @@ task("justcopy", [], function() {
.include(path.join(styleDir,"locales","*.xml"))
.include(path.join(styleDir,"scripts","*.js"));
copyFiles(styleDir,js.toArray(),path.join(webclient,styleDir));

js = new jake.FileList().include(path.join(contribDir,"styles","*.css"))
.include(path.join(contribDir,"styles","*.mdk"))
.include(path.join(contribDir,"styles","*.bib"))
.include(path.join(contribDir,"styles","*.cls"));
copyFiles(path.join(contribDir,"styles"),js.toArray(),path.join(webclient,styleDir));

js = new jake.FileList().include(path.join(contribDir,"images","*.png"))
.include(path.join(contribDir,"images","*.pdf"));
copyFiles(contribDir,js.toArray(),path.join(webclient,styleDir));

jake.mkdirP(path.join(webclient,"templates","style"));
var templateDir = path.join(contribDir,"templates");
js = new jake.FileList().include(path.join(templateDir,"*"))
Expand All @@ -195,13 +209,13 @@ task("justcopy", [], function() {
var sty = new jake.FileList().include(path.join(styleDir,"*.sty"));
// copyFiles(styleDir,sty.toArray(),localTexDir);
copyFiles(styleDir,sty.toArray(),path.join(webclient,styleDir))
});
});

task("webcopy",["web","justcopy"], function() {
});

//-----------------------------------------------------
// Tasks: test
// Tasks: test
//-----------------------------------------------------
desc("run tests.\n test[--extra] # run tests for extensions.");
task("test", ["madoko"], function() {
Expand All @@ -210,29 +224,29 @@ task("test", ["madoko"], function() {
testCmd = "node test " + testFlags + args.filter(function(s){ return (s.substr(0,2) == "--"); }).join(" ")
jake.log("> " + testCmd)
jake.exec(testCmd, {printStdout: true, printStderr: true})
});
});

//-----------------------------------------------------
// Tasks: bench
// Tasks: bench
//-----------------------------------------------------
desc("run benchmark.\n bench[--quick] # run the bench mark in quick mode.");
task("bench", [], function() {
testFlags=(process.env.testFlags||"")
testFlags=(process.env.testFlags||"")
args = Array.prototype.slice.call(arguments)
testCmd = "node test --bench --gfm " + testFlags + args.join(" ")
jake.log("> " + testCmd)
jake.exec(testCmd,{interactive:true})
});
});

//-----------------------------------------------------
// Tasks: doc
//-----------------------------------------------------
desc("generate documentation.\n doc[--pdf] # generate pdf too (using LaTeX).")
desc("generate documentation.\n doc[--pdf] # generate pdf too (using LaTeX).")
task("doc", [], function() {
var docout = "out";
args = Array.prototype.slice.call(arguments).join(" ");
var pngs = new jake.FileList().include(path.join("doc","*.png"));
copyFiles("doc",pngs.toArray(),path.join("doc",docout));
copyFiles("doc",pngs.toArray(),path.join("doc",docout));
process.chdir("doc");
mdCmd = "node ../lib/cli.js -v --odir=" + docout + " " + args + " reference.mdk mathdemo.mdk slidedemo.mdk";
jake.log("> " + mdCmd);
Expand Down Expand Up @@ -268,19 +282,19 @@ task("publish", [], function () {
//-----------------------------------------------------
// Tasks: line count
//-----------------------------------------------------
desc("line count.")
desc("line count.")
task("linecount", [], function() {
var sources = new jake.FileList().include(path.join(sourceDir,"*.kk"));
// var sources = new jake.FileList().include(path.join("lib","*.js"));
var src = sources.toArray().map( function(file) { return fs.readFileSync(file,{encoding:"utf8"}); }).join()
//xsrc = src.replace(/^[ \t]*\/\*[\s\S]*?\*\/[ \t\r]*\n|^[ \t]*\/\/.*\n/gm, "")
comments = lineCount(src.match(/^[ \t]*\/\*[\s\S]*?\*\/[ \t\r]*\n|^[ \t]*\/\/.*\n/gm).join())
blanks = src.match(/\r?\n[ \t]*(?=\r?\n)/g).length
blanks = src.match(/\r?\n[ \t]*(?=\r?\n)/g).length
total = lineCount(src)
jake.log("total lines : " + total)
jake.log("total lines : " + total)
jake.log(" source lines : " + (total-comments-blanks))
jake.log(" comment lines: " + comments)
jake.log(" blank lines : " + blanks )
jake.log(" comment lines: " + comments)
jake.log(" blank lines : " + blanks )
});

function lineCount(s) {
Expand All @@ -291,8 +305,8 @@ function lineCount(s) {
// Tasks: documentation generation & editor support
//-----------------------------------------------------
var cmdMarkdown = "node " + path.join(outputDir,maincli + ".js");
desc("create source documentation.")

desc("create source documentation.")
task("sourcedoc", [], function(mode) {
jake.logger.log("build documentation");
var out = outputDir + "doc"
Expand Down Expand Up @@ -322,11 +336,11 @@ task("sublime", function(sversion) {
var sversion = sversion || "2"
if (process.env.APPDATA) {
sublime = path.join(process.env.APPDATA,"Sublime Text " + sversion);
}
}
else if (process.env.HOME) {
if (path.platform === "darwin")
if (path.platform === "darwin")
sublime = path.join(process.env.HOME,"Library","Application Support","Sublime Text " + sversion);
else
else
sublime = path.join(process.env.HOME,".config","sublime-text-" + sversion);
}
sublime = path.join(sublime,"Packages");
Expand All @@ -339,7 +353,7 @@ task("sublime", function(sversion) {
var sublimeCS = path.join(sublime,dirCS);

jake.mkdirP(sublimeCS);
jake.cpR(path.join("support","sublime-text","Snow.tmTheme"),sublimeCS);
jake.cpR(path.join("support","sublime-text","Snow.tmTheme"),sublimeCS);
jake.cpR(path.join("support","sublime-text","madoko"),sublime);
}
});
Expand All @@ -356,7 +370,7 @@ var usageInfo = [
function showHelp() {
jake.logger.log(usageInfo);
jake.showAllTaskDescriptions(jake.program.opts.tasks);
process.exit();
process.exit();
}

desc("show this information");
Expand Down Expand Up @@ -385,12 +399,12 @@ function getVersion() {
}
}
return "<unknown>"
}
}


function fixVersion(fname) {
fname = fname || path.join(sourceDir,"version.kk");

var version = getVersion();
var content1 = fs.readFileSync(fname,{encoding: "utf8"});
if (content1) {
Expand All @@ -399,14 +413,14 @@ function fixVersion(fname) {
if (content1 !== content2) {
jake.logger.log("updating version string in '" + fname + "' to '" + version + "'")
fs.writeFileSync(fname,content2,{encoding: "utf8"});
}
}
}
}

function fileExist(fileName) {
var stats = null;
try {
stats = fs.statSync(fileName);
stats = fs.statSync(fileName);
}
catch(e) {};
return (stats != null);
Expand All @@ -417,12 +431,12 @@ function fileExist(fileName) {
function copyFiles(rootdir,files,destdir) {
rootdir = rootdir || "";
rootdir = rootdir.replace(/\\/g, "/");
jake.mkdirP(destdir);
jake.mkdirP(destdir);
files.forEach(function(filename) {
// make relative
var destname = path.join(destdir,(rootdir && filename.lastIndexOf(rootdir,0)===0 ? filename.substr(rootdir.length) : filename));
var logfilename = (filename.length > 30 ? "..." + filename.substr(filename.length-30) : filename);
var logdestname = (destname.length > 30 ? "..." + destname.substr(destname.length-30) : destname);
var logfilename = (filename.length > 30 ? "..." + filename.substr(filename.length-30) : filename);
var logdestname = (destname.length > 30 ? "..." + destname.substr(destname.length-30) : destname);
//jake.logger.log("cp -r " + logfilename + " " + logdestname);
jake.cpR(filename,path.dirname(destname));
})
Expand Down
Loading