Errors while using VS Code extension - visual-studio-code

I try to use the VS Code extension for Isabelle 2019. When I try to open the Isabelle output I get the exception
Exception in thread "event_timer" java.util.NoSuchElementException: key not found: IsabelleDejaVuSans.ttf
at scala.collection.MapLike.default(MapLike.scala:231)
at scala.collection.MapLike.default$(MapLike.scala:230)
at scala.collection.AbstractMap.default(Map.scala:59)
at scala.collection.MapLike.apply(MapLike.scala:140)
at scala.collection.MapLike.apply$(MapLike.scala:139)
at scala.collection.AbstractMap.apply(Map.scala:59)
at isabelle.HTML$.font_face$1(html.scala:366)
at isabelle.HTML$.$anonfun$fonts_css$1(html.scala:371)
at scala.collection.immutable.List.map(List.scala:282)
at isabelle.HTML$.fonts_css(html.scala:371)
at isabelle.Present$.output_document$1(present.scala:120)
at isabelle.Present$.preview(present.scala:138)
at isabelle.vscode.Preview_Panel.$anonfun$flush$2(preview_panel.scala:33)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1(TraversableOnce.scala:156)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1$adapted(TraversableOnce.scala:156)
at scala.collection.Iterator.foreach(Iterator.scala:937)
at scala.collection.Iterator.foreach$(Iterator.scala:937)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:156)
at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:154)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1425)
at scala.collection.TraversableOnce.$div$colon(TraversableOnce.scala:150)
at scala.collection.TraversableOnce.$div$colon$(TraversableOnce.scala:150)
at scala.collection.AbstractIterator.$div$colon(Iterator.scala:1425)
at isabelle.vscode.Preview_Panel.$anonfun$flush$1(preview_panel.scala:27)
at isabelle.Synchronized.change_result(synchronized.scala:73)
at isabelle.vscode.Preview_Panel.flush(preview_panel.scala:24)
at isabelle.vscode.Server.$anonfun$delay_preview$2(server.scala:210)
at isabelle.Standard_Thread$Delay.run(standard_thread.scala:64)
at isabelle.Standard_Thread$Delay.$anonfun$invoke$1(standard_thread.scala:77)
at isabelle.Event_Timer$$anon$1.run(event_timer.scala:27)
at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
at java.base/java.util.TimerThread.run(Timer.java:506)
If I then do anything else (for example typing in the code window) another exception is raised every time
[Error - 9:01:48 PM] java.lang.IllegalStateException: Timer already cancelled.
How can I get rid of these two errors?
I found the same or a similar problem here, and they recommend running
$ isabelle scala
scala> import isabelle._
scala> Isabelle_Fonts.fonts(hidden = true)
Which results in
res0: List[isabelle.Isabelle_Fonts.Entry] = List(Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSans.ttf",false), Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSans-Bold.ttf",false), Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSans-Oblique.ttf",false), Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSans-BoldOblique.ttf",false), Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSansMono.ttf",false), Entry("/home/daniel/opt/isabelle/contrib/isabelle_fonts-20190409/ttf-hinted/IsabelleDejaVuSansMono-Bold.ttf",false), Entry("/home/daniel/opt/isabelle/con...

The plain answer: Isabelle2019 does not support VSCode --- that platform is moving too fast and assuming quick movements.
In Isabelle2020 (April 2020) it should work again. Approximations of this release is available here: https://sketis.net/2020/release-process-for-isabelle2020
See also https://marketplace.visualstudio.com/items?itemName=makarius.Isabelle2020

Related

vscode python lint problem at the first column of first line

I have python modules that I run in VSCode for development.
And everything works fine until today VSCode suddenly said that one of the module had some binding problem and made the file name tab red.
VSCode the problem occurs in the first character of the first line which is the following standard line at every module of my program.
from __future__ import print_function # (at top of module)
But strangely VSCode did not raise the same problem for other module that starts with the same line.
The problem message is like this.
An internal error occurred while binding file "aModule.py": Error: Debug Failure. createKeyForReference received unexpected expression type
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:240:9)
at createKeyForReference (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\codeFlowTypes.ts:218:25)
at C.visitAssignment (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:849:50)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:132:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at forEach (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:107:22)
at Array.forEach (<anonymous>)
at C.walkMultiple (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:105:15)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:100:18)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1290:22)
at C._trackCodeFlowExpressions (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:3236:9)
at C.visitIf (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:1265:48)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:184:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at C._walkStatementsAndReportUnreachable (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:2583:22)
at C.visitSuite (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:345:14)
at C.visitNode (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:330:29)
at C.walk (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\parseTreeWalker.ts:98:37)
at Object.callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:545:22)
at C._bindDeferred (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:4140:22)
at C.bindModule (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\binder.ts:298:14)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1197:28)
at s.timeOperation (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\timing.ts:40:20)
at callback (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1184:38)
at t.LogTracker.log (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\common\logTracker.ts:43:20)
at t.SourceFile.bind (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\sourceFile.ts:1181:33)
at O._bindFile (c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:931:34)
at c:\Users\Farn\.vscode\extensions\ms-python.vscode-pylance-2022.7.40\dist\pyright-internal\src\analyzer\program.ts:1051:18
Can someone help?
Thanks
Farn

Using CleanroomLogger in a Swift script fails to resolve DefaultLogConfiguration

I'm just starting to play with Swift 2.0 for scripting and running into an issue with symbols being resolved.
Using Carthage I bootstrap from a Cartfile containing
github "emaloney/CleanroomLogger"
I am able to get CleanroomLogger working inside of Playground by:
Create a Workspace inside of XCode 7.1.1
Add the CleanroomLogger.xcodeproj file from ./Carthage/Checkouts/CleanroomLogger
Create a new Playground in the project
Inside of the playground I enter the code
import CleanroomLogger
var logConfig = DefaultLogConfiguration.init(minimumSeverity: LogSeverity.Debug, synchronousMode: true)
Log.enable(logConfig)
Log.debug?.message("Sample message sent to debug")
Log.debug?.value("Sample value sent to debug")
This plays without error. I only see () as the output in the playground next to each Log.debug? call which is expected. If I open up the Console app I see two entries:
11/20/15 10:33:51.455 PM Cleanroom Logger[70056]: DEBUG | <EXPR>:5 — Sample message sent to debug
11/20/15 10:33:51.455 PM Cleanroom Logger[70056]: DEBUG | <EXPR>:6 — <String: "Sample value sent to debug">
So clearly I have CleanroomLogger checked out and properly built at this point.
I proceed to try and use Cleanroom Logger from a script logger-demo.swift located in the same directory as my Cartfile. This script is identical to the playground code with the addition of the shebang at the start
#!/usr/bin/env swift -F Carthage/Build/Mac
import CleanroomLogger
var logConfig = DefaultLogConfiguration.init(minimumSeverity: LogSeverity.Debug, synchronousMode: true)
Log.enable(logConfig)
Log.debug?.message("Hello from inside my Mac")
Log.debug?.value("This is a test of value")
Running the script results in the following output:
$ ./logger-demo.swift
LLVM ERROR: Program used external function '__TMdV15CleanroomLogger23DefaultLogConfiguration' which could not be resolved!
Why would this resolve in a playground but not from a swift script?
Wow, that sounds complicated ...
Maybe try SwiftyBeaver logger for Swift 2 instead. It is simple(!), supports colors, is fast & is much more feature-complete.
P.S.: I am the creator :)

threads error in running stanford LLDA tmt scala models

when I run stanford LLDA tmt scala models, I encounter a few problems. One of them is a thread error when I try to do inference with LLDA tmt model. The code I am running is exactly the one provided by Shreyas Karnik in the sourceforge link,
#Skarab: Here are the links to the code which I used to bit.ly/ocK2T9 (learning) and bit.ly/qIWb6C (inference) please let me know if you still encounter any errors.
The error message is,
Command started: Fri Jun 21 21:34:48 CDT 2013
java -Dscalanlp.distributed.hub=socket://crick7.mayo.edu:41080/hub -Dscalanlp.distributed.id=/tmt/0 -Xmx100000m edu.stanford.nlp.tmt.TMTMain "/data4/bsi/nlp/s110067.sharp/bioask/tmtModels/example-7-llda-infer.scala"
Loading model ...
TSVFile("test.csv") ~> IDColumn(1) ~> Column(2) ~> TokenizeWith(SimpleEnglishTokenizer.V1() ~> CaseFolder() ~> WordsAndNumbersOnlyFilter() ~> MinimumLengthFilter(3))
Generating output ...
[Concurrent] 128 permits
[Concurrent] 128 permits
Exception in thread "Thread-3" java.lang.IndexOutOfBoundsException: 1
at scala.collection.LinearSeqOptimized$class.apply(LinearSeqOptimized.scala:51)
at scala.collection.immutable.List.apply(List.scala:45)
at scalanlp.stage.Column.map(ColumnSelectors.scala:51)
at scalanlp.stage.Column.map(ColumnSelectors.scala:46)
at scalanlp.stage.generic.Mapper$$anonfun$apply$1$$anonfun$apply$2.apply(Mapper.scala:36)
at scalanlp.stage.Item.map(Item.scala:32)
at scalanlp.stage.generic.Mapper$$anonfun$apply$1.apply(Mapper.scala:36)
at scalanlp.stage.generic.Mapper$$anonfun$apply$1.apply(Mapper.scala:36)
at scala.collection.Iterator$$anon$19.next(Iterator.scala:335)
at scala.collection.Iterator$$anon$19.next(Iterator.scala:335)
at edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anonfun$map$2.apply(Concurrent.scala:96)
at edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anonfun$map$2.apply(Concurrent.scala:88)
at edu.stanford.nlp.tmt.data.concurrent.Concurrent$$anon$4.run(Concurrent.scala:45)
Would you give help? highly appreciate it!
This is a known issue of tmt-0.4.0 for many users. tmt-0.2.1 works just fine.
But the support for tmt-0.4.0 has been discontinued and for tmt-0.2.1 even before that.
You can check out http://mallet.cs.umass.edu/, which also has easy to start GUIs available such as http://www.themacroscope.org/?page_id=391.
Check any .csv files for DOS/Unix incompatibility.
My experience may be relevant:
I was also getting the error java.lang.IndexOutOfBoundsException, when running tmt-0.4.0 from a command line on Windows. My workflow had a python program splitting my data set into training and test .csv files. But they were written in DOS mode. See for example,
http://www.cs.toronto.edu/~krueger/csc209h/tut/line-endings.html
A confirmation of this is that when opening them in Excel, there was an extra line, and when opening them in Emacs, there's a telltale ^M.
I ran dos2unix on the .csv files, and then the TMT Scala programs worked.

Identify exact failed match from failed Scalacheck property in specs2

I am running a specs2 test suite from sbt, using the test command. When a ScalaCheck property fails, I just get to see the filename and line number in my code where the specs2 match fails - which is not very useful when that happens to be a utility method which does a common type of check that I am frequently doing. A stack trace would be better.
I've tried the last command in sbt, but that doesn't display the stack trace I'm looking for. The only stack trace last displays is this generic one:
java.lang.RuntimeException: Tests unsuccessful
at scala.sys.package$.error(package.scala:27)
at scala.Predef$.error(Predef.scala:66)
at sbt.Tests$.showResults(Tests.scala:168)
at sbt.Defaults$$anonfun$testTasks$5.apply(Defaults.scala:279)
at sbt.Defaults$$anonfun$testTasks$5.apply(Defaults.scala:279)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$5.work(System.scala:67)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:227)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I also have FINEST logging level enabled in the java.util.logging properties file.
For now I am working around this issue using the Eclipse debugger, but that's unnecessarily heavyweight in some cases.
You can display the stacktrace failures by passing the failtrace argument on the command line. This is documented in the Arguments part of the User Guide.
Also you have to know that this stacktrace is filtered to avoid showing specs2's own stack so if you want to see everything you need to add fullstacktrace which is a shortcut for a TraceFilter that filters nothing.
I decided to take a different approach to identifying the failed match - using aka, like this:
def occurExactlyOnceInBody = be_===(1) ^^ { (s: String) => body.tails.count(_.startsWith(s)) aka "No. of occurences of " + s + " in body" }
The downside is this does need to be applied manually, but the upside is it's easier to understand the failures.

Scala on Mac - Cannot figure out how to run target?

I'm attempting to run a Scala script that imports scala.IO.Source, which throws an exception every time I try to run it as follows:
Exception in thread "main" java.lang.RuntimeException: Cannot figure out how to run target: countchars1.scala
at scala.sys.package$.error(package.scala:27)
at scala.tools.nsc.GenericRunnerCommand.scala$tools$nsc$GenericRunnerCommand$$guessHowToRun(GenericRunnerCommand.scala:38)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.Option.getOrElse(Option.scala:108)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:17)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
I believe it is due to my Path or Classpath settings but I'm unsure what these need to be or where they need to be set. I have tried amending .bash_profile to no avail and have tried adding .profile with what I believe to be the required PATH settings but there doesn't appear to be a straight answer to this that I can find
I'm currently running Scala 2.9.1 on a Mac OSX 10.6. The script I'm trying to run from 'Programming in Scala' is as follows:
import scala.io.Source
if (args.length > 0) {
for (line <- Source.fromFile(args(0)).getLines)
print(line.length +" "+ line)
}
else
Console.err.println("Please enter filename")
I encounter the exception when I type the following in the terminal window:
$ scala countchars1.scala countchars1.scala
Any help with this would be much appreciated.
Managed to solve the issue by setting the JAVA_HOME variable using the following instructions:
http://decoding.wordpress.com/2010/02/26/how-to-set-the-java_home-variable-in-mac-os-x-snow-leopard/