VSCode : --jsx flag interferes with auto import suggestions - visual-studio-code

I have a typescript-react project.
When I include the jsx flag in the tsconfig.json file, it messes up the auto import suggestions.
If I don't include the jsx flag, auto import suggestions work, but I see errors that I can't use JSX without the --jsx flag as expected.
I have tried playing around with the tsconfig options, but sadly have had no luck.
Have I stumbled upon a VS Code bug or am I missing something very basic?
The relevant tsserver.log entry:
Debug Failure.
Error: Debug Failure.
at Object.assertDefined (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:2101:24)
at getDefaultExportInfoWorker (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118907:80)
at getDefaultLikeExportInfo (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118867:24)
at c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118850:35
at c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:119023:21
at forEachExternalModule (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:119036:21)
at forEachExternalModuleToImportFrom (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:119021:13)
at getExportInfos (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118848:13)
at getFixesInfoForNonUMDImport (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118834:57)
at getFixesInfo (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118772:50)
at Object.getCodeActions (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:118533:28)
at c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:115852:121
at Object.flatMap (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:583:25)
at Object.getFixes (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:115852:23)
at c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:125866:35
at Object.flatMap (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:583:25)
at Object.getCodeFixesAtPosition (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:125864:23)
at IOSession.Session.getCodeFixes (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:135063:64)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:133850:61)
at c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:135256:88
at IOSession.Session.executeWithRequestId (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:135247:28)
at IOSession.Session.executeCommand (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:135256:33)
at IOSession.Session.onMessage (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:135279:35)
at Interface.<anonymous> (c:\Codebase\webui\node_modules\typescript\lib\tsserver.js:136594:27)
at Interface.emit (events.js:182:13)
at Interface._onLine (readline.js:290:10)
at Interface._normalWrite (readline.js:433:12)
at Socket.ondata (readline.js:149:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
VS Code version: 1.38.1
Typescript version: 3.6.3
P.S. Copy-pasting or manually writing imports works, but I believe the IDEs have made us lazy on that front. :)

Related

setting bash editor as vscode throw error node:internal/modules/cjs/loader:990

I am trying to set up visual studio code as default editor on git bash. However, I keep facing the following issue.
node:internal/modules/cjs/loader:990
throw err;
^
Error: Cannot find module 'C:\Users\username\anaconda3\Library\c\Users\username\AppData\Local\Programs\Microsoft VS Code\resources\app\out\cli.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:987:15)
at Module._load (node:internal/modules/cjs/loader:832:27)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I've tried to reinstall vscode, git and nodejs. But it doesn't help.
Also tried editing the env path to no avail.
The error seems to lie in the module path itself which resolves to duplicated "c\Users\username..."
Appreciate any help here. Thanks!
UPDATE
I manage to dig deeper and found out that it is due to these particular lines of code that is causing the issue.
elif [ -x "$(command -v cygpath)" ]; then <-- THIS LINE
CLI=$(cygpath -m "$VSCODE_PATH/resources/app/out/cli.js")
They can be found in C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin\code.
Apparently, code is referencing to the cygpath that was installed by anaconda3 and hence ran the if statement. If I comment these 2 lines out to prevent cygpath from running, I am able to open vscode via bash with no issue. However, I don't think this is the long term solution.
Appreciate any advice. Thanks!

Databricks Extension Fails for Visual Studio Code

I try to install extension below on VS Code, but nothing happens when I click "Configure Databricks"
Extension:
https://marketplace.visualstudio.com/items?itemName=databricks.databricks&ssr=false#qna
Details from Developer: Toggle Developer Tools
ERR Command failed:
c:\Users\user.name.vscode\extensions\databricks.databricks-0.2.3-win32-x64\bin\bricks
auth profiles --skip-validate Error: cannot parse config file: open
C:\Test" /M: The filename, directory name, or volume label syntax is
incorrect. : Error: Command failed:
c:\Users\user.name.vscode\extensions\databricks.databricks-0.2.3-win32-x64\bin\bricks
auth profiles --skip-validate Error: cannot parse config file: open
C:\Test" /M: The filename, directory name, or volume label syntax is
incorrect.
at ChildProcess.exithandler (node:child_process:408:12) at
ChildProcess.emit (node:events:526:28) at maybeClose
(node:internal/child_process:1092:16) at Socket.
(node:internal/child_process:451:11) at Socket.emit
(node:events:526:28) at Pipe. (node:net:687:12)
How can I fix it? Does anyone else had any issues?
It seems like the extension can't read your Databricks profile (~/.databrickscfg). Check if the file exists and if it contains potentially problematic contents.
I've create a ticket to track this issue https://github.com/databricks/databricks-vscode/issues/462

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

Jest Your are trying to import a file after the jest environment has been torn down

when i import a file into my test file i have the following error :
ReferenceError: You are trying to import a file after the Jest environment has been torn down. From __test__/C_Mail.test.js.
at BufferListStream.Readable (node_modules/readable-stream/lib/_stream_readable.js:170:22)
at BufferListStream.Duplex (node_modules/readable-stream/lib/_stream_duplex.js:60:12)
at new BufferListStream (node_modules/bl/bl.js:33:16)
at new IncomingMessageStream (node_modules/tedious/lib/incoming-message-stream.js:34:15)
at new MessageIO (node_modules/tedious/lib/message-io.js:41:34)
C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\readable-stream\lib\_stream_readable.js:174
var isDuplex = this instanceof Duplex;
^
TypeError: Right-hand side of 'instanceof' is not callable
at BufferListStream.Readable (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\readable-stream\lib\_stream_readable.js:174:23)
at BufferListStream.Duplex (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\readable-stream\lib\_stream_duplex.js:60:12)
at new BufferListStream (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\bl\bl.js:33:16)
at new IncomingMessageStream (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\tedious\lib\incoming-message-stream.js:34:15)
at new MessageIO (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\tedious\lib\message-io.js:41:34)
at C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\tedious\lib\connection.js:1442:24
at Socket.onConnect (C:\Users\anisb\OneDrive\Bureau\alertemail\projetHexakey\node_modules\tedious\lib\connector.js:156:7)
at Socket.emit (node:events:526:28)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1143:10)
Can someone help me ?
I tried to solve using jest.UseFakeTimers() but not useful for me, it tried everything on the web but i didn't found the solution
Thanks everybody

Errors while using VS Code extension

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