Is there any command line tool to format dart code? - dart

I want to use sublime to write dart code. It has a dart plugin which can highlight the syntax, but can't format it.
I searched and found there is no plugin for sublime for now to format the dart code, so I want to find a command line tool, and invoke it from my sublime.
Is there such a tool?

The dart team has started to work on a code formatter inside the Analyzer package but it's still a work in progress. You can have a look at the CodeFormatter class. You can also follow the corresponding issue : Dart formatter.

This answer is not about a command line tool, but if you have WebStorm, there is a Dart plugin for it under Settings->Plugins.
After you have installed it, you can just open any file and press ctrl+shift+f to format it.

for the command line: dartfmt: The Dart Code Formatter
In DartEditor this can now be done using the context menu inside the code window and choose 'Format' or just press Ctrl+Shift+r

dart format . will format all files in the directory.

Related

How to highlight Flutter / DART code segment in Overleaf Latex?

I made a project with Flutter, with Dart language, and I'm trying to write a report on it. I need to copy code segments to the document, however I can't highlight my dart code. The closest I can get is with the java highlight, but it's still not quite right...
\begin{minted}{java}
//my dart code
\end{minted}
Thanks, I appreciate the help!
The minted package is based on Pygments. Pygments lists Dart as a supported language, so it should work (for me it works). May be the problem is otherwise. Two possible problems/solutions:
Updating the packages with your LaTeX distribution.
If you are using another directory to put all output files o auxiliary files with --output-directory=dir or --aux-directory=dir commands, use the command \usepackage[outputdir=dir]{minted} to point to same directory.

VS Code Dart extension: how do I disable Dart style warnings?

I don't want to name .dart files using "lowercase_with_uderscores". How do I disable this warning in Dart VS Code extension? Moreover, when I rename my file to lowercase, it still shows the same warning each time I make changes to the file. Any idea on how to disable these warnings for good, not just for one file, but for the whole project? I know what's best for me, I'm just trying to code...
This is what I see:
Just comment this highlighted line of code in the analysis_options.yaml file...

How to get autocompletion for custom modules in Lua

Whatever the setup I use for coding in Lua is always the same thing: autocompletion works for the standard libraries but not for the 3rd parties or my own libraries.
I tried ZeroBrane studio, VSCode with Lua plugin and Vim with lua ftplugin, exact same behaviour in all 3. I start typing a standard library symbol such as
io.w
And I do get the autocompletion popup showing everything in the io module, and showing the closest method to io.w which would be io.write, with the signature and documentation.
Now I try a 3rd party or my own library such as
require("wx"); wx.
or
require("my_module"); my_module.
Either nothing happens at all, or I get a warning "undefined" on the module name.
If I run the code with the interpreter, it does work. It will call the function in the module just fine. But in the editor, warning and no autocompletion.
Am I missing something?
wxwidgets API comes prepackaged with ZeroBrane Studio, but it needs to be explicitly enabled (you can add api = {"wxwidgets"} to the config file to do that; see Custom APIs section in the documentation). Any other (non-packaged) API would need to be added to the IDE as documented here. There are several popular APIs already provided as plugins; for example, for Redis, Urho3d, openRA and others.

travis-lint: why does it complain about java language field

I have this dead simple .travis.yml for a java project. When i run 'travis-lint' against the file is complains
[17:24:23#emeraldjava]$ travis-lint
/Users/pauloconnell/projects/emeraldjava/.travis.yml has issues:
Found an issue with the `language:` key:
Language must be valid
Any ideas?
My build actually works once deployed out.
Until the problem is resolved with the command line tool, and as #joshua-anderson proposed, use the web linter http://lint.travis-ci.org/.
Simply copy/paste your .travis.yml file's content their (or use your github repository directly like emeraldjava/emeraldjava) and hit validate.

Is it possible to autoformat source code using Clang?

Is it possible to autoformat translation unit (source code) using Clang C API? I'm able to parse translation unit, but i can't find any according method for my goal.
They have made a nice tool for formatting source code already - Have a look at:
$YOUR_LLVM_DIR/clang/tools/clang-format/ClangFormat.cpp
For Xcode users:
Download and install Package Manager here: http://alcatraz.io
Install ClangFormat by clicking on the icon to the left of it.
In the Edit>Clang Format menu, select Enable Format on Save
Now your files will be automatically formatted as you save.

Resources