Python lining for Online Ace editor - javascript

In our web application, we are using the react-ace code editor with language mode python. We are trying to implement python linting in our code editor.
Ace editor doesn't have any python linting. So we tried to explore for pylint packages and integrate them into ace worker (Ace syntax validation). In our exploration, we got a few inputs like using Skulpt, Pyodide. But these two packages compile the python code and even if the error is in multiple lines, they give the 1st error line as a result.
Means for example ace editor already have javascript linting. In
this image the warning is shown for both the lines.
But when we use Skulpt, Pyodide it gives only one error/warning message, check this image. In this image both a and b are not defined but output gives only a is not defined. What we are expecting is python linting should show for every line of code.
Are there any other packages for python linting to use in web environment?

Related

How to get readline-sync working in JavaScript in VisualStudioCode?

I would like to allow a JavaScript program running in VisualStudioCode to use readline-sync, but when I try to use the
const input = require('readline-sync');
line that works in environments like Replit after causing that module to be added, I get an error message about not having the appropriate module. In trying to find an answer to this question, I have gotten the impression that modifying a "package.json" file is involved. However, I'm not sure exactly where this file is supposed to be and believe that I may not have one for my current project yet. When I use VSC's Command Palette to enter the
JavaScript: Go to Project Configuration
command, I get a popup in the lower-right corner that says
"Please open a folder in VS Code to use a TypeScript or JavaScript project
Source: TypeScript and JavaScript Language Features (Extension)"
I believe that the problem may have something to do with the fact that I have previously mainly used VSC for standalone code pages that interacted only with the console or with languages other than JavaScript and am not really familiar with how to set up a project that requires multiple files to work in conjunction in the VSC environment.

How to run Python with ACE Editor

I'm trying to create an online python editor and want to use Ace Editor to do so. How does one render or compile python code on the browser using Ace Editor's CDN with HTML/JS (https://ace.c9.io)?
I was successful in compiling a live view of HTML and Javascript using the contentWindow.document function; however, I can't seem to figure out how to do the same, except with Python instead.
ACE Editor is just a code editor, it doesn't include any compiler of any kind. What you are looking for is for a web service that allows you to submit some Python code, then run it on the host server with Python support and return a response.
The best solution would be to implement a Python Sandbox that will run untrusted Python code, ideally through docker or something on a virtual machine where no other code or data of yours could be compromised. Check Pysandbox for a docker solution example.

Auto-format javascript code in RStudio Server

In RStudio it´s possible to autoformat R Code with CTRL+SHIFT+A (e.g. see this answer). Now my question is, how to autoformat javascript code in RStudio (e.g. if you are working on a shiny app).
The prettifyAddins package I've just made provides two RStudio addins for JavaScript files and more: an addin which only reindents the code and an addin which prettifies the code, e.g. it adds semi-colons when they are missing. I will submit it to CRAN soon.
Update
I updated prettifyAddins. It has now addins using the V8 package, and Shiny is not used for these addins, the prettified code directly replaces the current code.
Another possibility is my (freshly built) package aceEditor. It opens the Ace editor in the viewer pane of RStudio:
This provides a second source editor in RStudio. And many languages are supported.

Typescript debug with line number

Opening up the console in a browser shows the javascript line number of a function call or error message.
But I am using TypeScript which is being compiled to Javascript.
Is there a way I can get the line numbers for TypeScript?
I am using VSCode as my editor
There are source maps, but the simple thing to do is to navigate to the source, provided that for development it's not being uglified and rollified and minified, in that case you need source maps.
Otherwise simply using the generated JavaScript file usually points to what the issue might be in the source code. If this sounds cumbersome you can always open a side by side view of source and the built JS.

JavaScript code analysis in VS2010

It is possible to enable a code editor helpers for .js files in Visual Studio 2010.
I am tasked to alter the existing JavaSript files, and I am having a hard time to even getting around the written codes, since VS editor treats JS as text. I think Notepad++ would do a better job in this case.
Consider a simple example in the image below:
When an opening braces are selected, the closing ones should also be highlighted so see the boundaries of the function.
The question is: Is there an extension, or some other add-in to VS to enable comfort javascript editing?
JScript Editor Extensions looks good

Categories

Resources