Why is clang-tidy not getting its options set through ALE? - vim-plugin

I'm able to run clang-tidy with my source file clang-tidy -p build/compile_commands.json filename.h and it works as expected. When I open the file through vim I get errors with the first #includes, which happens if I leave the -p option off the invocation.
In my vimrc I tried setting g:ale_c_build_dir to build and that didn't work, so I tried setting g:ale_cpp_clangtidy_extra_options with the -p argument above and that didn't work. I'm able to confirm that these values are being set properly with ALEInfo, they're just not being used in the clang-tidy invocation apparently.

I am currently trying to set ALE up with clang-tidy myself, and eventually got it working with the following config:
let g:ale_linters = {
\ 'cpp': ['clangtidy'],
\ 'c': ['clangtidy'],
\}
let g:ale_fixers={
\ 'cpp': ['clang-format'],
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\}
let g:ale_cpp_clangtidy_checks = []
let g:ale_cpp_clangtidy_executable = 'clang-tidy'
let g:ale_c_parse_compile_commands=1
let g:ale_cpp_clangtidy_extra_options = ''
let g:ale_cpp_clangtidy_options = ''
let g:ale_set_balloons=1
let g:ale_linters_explicit=1
let g:airline#extensions#ale#enabled=1
As you can see, i have skipped setting g:ale_c_build_dir_names or g:ale_c_build_dir, since the defaults should do the job just fine (see excerpts from documentation below), given that your compile_commands.json resides in build or bin directory of the root of your project. One thing i have noticed is that linting with clang-tidy when used as ALE's linter is very slow.
g:ale_c_build_dir_names
Type: List
Default: ['build', 'bin']
A list of directory names to be used when searching upwards from cpp
files to discover compilation databases with. For directory named 'foo',
ALE will search for 'foo/compile_commands.json' in all directories on and above
the directory containing the cpp file to find path to compilation database.
This feature is useful for the clang tools wrapped around LibTooling (namely
here, clang-tidy)
And:
g:ale_c_build_dir
Type: String
Default: ''
For programs that can read compile_commands.json files, this option can be
set to the directory containing the file for the project. ALE will try to
determine the location of compile_commands.json automatically, but if your
file exists in some other directory, you can set this option so ALE will
know where it is.
This directory will be searched instead of g:ale_c_build_dir_names.

Related

The system cannot find the path specified, but then displays result

I'm trying to learn about gherkin, cucumber, npm in vscode.
I'm getting the usual "The system cannot find the path specified" error message, but then the result is shown as normal underneath.
C:\projects\vscode1>npm --version
The system cannot find the path specified.
7.11.2
It also does not recognize paths with "." in them, so "C:\projects\vscode1>./node_modules/.bin/cucumber-js" shows a different error.
C:\projects\vscode1>./node_modules/.bin/cucumber-js
'.' is not recognized as an internal or external command,
operable program or batch file.
The folder definitely exists inside node_modules as .bin.
During npm installation the cmd for the extra components, where it installs chocolatey etc, would not complete so I'm not sure if this is related. I have done a repair on the installer but it did not fix the problem.
UPDATED
I can run it in CMD without this .bin problem, but there is no output. The code I'm trying to run is:
const { Given } = require("#cucumber/cucumber")
//const (Given) = require('cucumber')
Given('a user opens {string}', (url) => {
console.log(url)
})
vscode.feature
Feature: vscode feature
Feature Description
Scenario: Scenario name
Given a user opens "https://www.duckduckgo.com/"
The tutorial can be found at: https://www.youtube.com/watch?v=bsGr6xjZ0mY

How to debug neovim lsp custom command

I am attempting to get the volar vue language server to work in place of vetur for neovim's native lsp.
Using both lspconfig and lspinstall I was able to create a working custom install for sumneko_lua (unrelated but had to manually build due to some issues with the built-in :LspInstall lua). Below is that code duplicated and modified for an attempt at using this new vue server:
local vue_config = require'lspinstall/util'.extract_config('vuels')
vue_config.default_config.cmd = {'node', './node_modules/vscode-vue-languageservice/out/index.js', '--stdio'}
require'lspinstall/servers'.newvue = vim.tbl_extend('error', vue_config, {
install_script = [[
! test -f package.json && npm init -y --scope=lspinstall || true
npm install vscode-vue-languageservice#latest
]],
uninstall_script = nil
})
Running :LspInstall newvue installs properly, however :LspInfo shows this language server is attached to the buffer (of a .vue file) but not active. I believe the issue is with this path: ./node_modules/vscode-vue-languageservice/out/index.js. It exists, but may not be the correct entry point? The default vue ls simply has vls as the command because it provides a binary. Am I missing something in this package? I have yet to come across another language server without a single binary to pick out.
Thanks!
Can you try an absolute path to the out.js file? In my pretty elaborate config for a custom Volar install I'm using something just /home/myuser/dev/volar/packages/server/out/index.js (where the volar folder is just the whole volar cloned github repo). My full config is here
I don't think you can use relative paths like you did. I know you're assuming that the "./node_modules" means "workspace directory" but it's hard to tell in which directory nvim-lspconfig opens up those executables.
I have yet to come across another language server without a single binary to pick out.
Volar also provides a binary, it's volar-server (after running npm i -g #volar/server), it's just with a custom install (ie. alongside the real volar) you can't use it, because I assume you want to use your local install with custom code.
As for more indepth debugging/logging, you can check ~/.cache/nvim/lsp.log to see why the language server dies in detail.

How to setup WebStorm / IntelliJ so the output from Grunt console has links into the files, in the same way a FileWatcher that calls tsc would do

Using IntelliJ/WebStorm if I run tsc from a FileWatcher, my compile errors are linked to the files in the editor, such that if I double-click on a compiler error, it opens that file and takes me to the offending line of code.
However if I run Grunt, either via the integrated Grunt console, or via a FileWatcher, the compile errors do not have links and I have to manually open the file and goto the offending line number.
Is there any way to get the compile errors comming from Grunt integrated as links, like the TypeScript FileWatcher's invocation of tsc does?
When running Grunt as a file watcher, you can set up filters to make links clickable. You can use existing filters as example: open your file watcher settings, press Output Filters..., open the filter settings and copy the regular expression specified there. See http://www.jetbrains.com/webstorm/webhelp/add-filter-dialog.html
In Webstorm 8, it is not possible to apply regular expression filters on Grunt console output.
The way to go, as mentioned by lena, is to call Grunt directly via an External tool entry, and set up appropriate regex filters, such as:
For grunt-ts:
$FILE_PATH$\($LINE$,$COLUMN$\):.*
For grunt-tslint:
...$FILE_PATH$\[$LINE$,\s$COLUMN$\]:.*
Also see my comment above regarding a caveat for grunt-tslint in some environments.
I believe the '>>' added by grunt-typescript is throwing it off. Try grunt-ts (disclaimer : one of the authors) which is tested with webstorm https://github.com/grunt-ts/grunt-ts
I noticed in Webstorm 9, the built-in Grunt console was filtering/linking on typescript compile errors with grunt-typescript. I am not sure if this is a recent change or not, but it was linking this for example,
So, I went into grunt-tslint/node_modules/tslint/build/formatters, and copied proseFormatter.js to ./myproseFormatter.js. Then I tweaked it so the tslint output format would match the compile error format, by replacing square brackets with parens, and removing the whitespace between line and column number. Finally, I referenced my custom formatter in my gruntfile tslint config by adding the formatter and formattersDirectory properties:
tslint: {
options: {
configuration: grunt.file.readJSON('tslint.json'),
formatter: 'myprose',
formattersDirectory: './'
},
all: {
src: [ 'app/**/*.ts' ]
}
}
and it worked!

Can't select all .hbs files in subfolders on windows

I want to precompile my ember templates. I installed an application for that, but I can only precompile one file.
I need like to select all files with .hbs extension including subfolders
I tried ember-precompile "components/**/*.hbs" -f precompiledTemplates.js
I get error saying
Error: ENOENT, no such file or directory 'components\**\*.hbs'
How do I say the program to look for .hbs files in all subfolders ?
I figured it's probably not a windows problem, but a limitation of the library I wanted to use(ember-precompile).
Instead I chose to use gulp which works well https://www.npmjs.org/package/gulp-ember-handlebars
Here's my coffeescript gulpfile for precompiling ember templates. After initiating gulp, it compiles my templates, and if one of templates changes, gulp recompiles.
gulp = require("gulp")
concat = require("gulp-concat")
handlebars = require("gulp-ember-handlebars")
gulp.task( "default", ["precompile-ember-templates"], ()->
# default tasks complete
)
gulp.task( "precompile-ember-templates", ()->
console.log("recompiling templates")
gulp.src( ["client/components/**/*.hbs"] )
.pipe( handlebars({outputType: 'browser'}) )
.pipe( concat("templates-compiled.js") )
.pipe( gulp.dest("client/public/") )
)
gulp.watch( "client/components/**/*.hbs", ["precompile-ember-templates"] )
There does seem to be a limitation within the Ember-Precompile code when handling the windows file structure and wildcards.
When running ember-precompile on windows you must do so through a cygwin terminal or similar (in my case I use git bash).
As an example in git bash when I type the line below in my project folder it works for me:
ember-precompile templates/*.handlebars -f templates/templates.js

Hadoop configurations seem not to be read

Every time when I try to start my mapreduce application (in standalone Hadoop), it tries to put stuff in the tmp directory, which it can't:
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-username\mapred\staging\username-1524148556\.staging to 0700
It ties to use an invalid path (slashes should be the other way around for cygwin).
I set hadoop.tmp.dir in core-site.xml (in the conf folder of Hadoop), but it seems that the config file is never read (if I put syntax errors in the file, it makes no difference). I added:
--config /home/username/hadoop-1.0.1/conf
To the command, but no difference. I also tried:
export HADOOP_CONF_DIR=/home/username/hadoop-1.0.1/conf
but also that does not seem to have an effect....
Any pointers on why the configs would not be read, or what else I am failing to see here?
Thanks!
It's not that the slashes are inverted, it's that /tmp is a cygwin path which actually maps to /cygwin/tmp or c:\cygwin\tmp. since hadoop is java and doesn't know about cygwin mappings, it takes /tmp to mean c:\tmp.
there's an awful lot of stuff to patch if you want to get 1.0.1 running on cygwin.
see: http://en.wikisource.org/wiki/User:Fkorning/Code/Hadoop-on-Cygwin
I found the following link useful, it seems that the problem stands with newer version of Hadoop. I'm using version 1.0.4 and I'm still facing this problem.
http://comments.gmane.org/gmane.comp.jakarta.lucene.hadoop.user/25837
UPDATED: in Mahout 0.7 and for the ones who use the "Mahoot in Action" book example, you shoud change the example code as follows:
File outFile = new File("output");
if (!outFile.exists()) {
outFile.mkdir();
}
Path output = new Path("output");
HadoopUtil.delete(conf, output);
KMeansDriver.run(conf, new Path("testdata/points"), new Path("testdata/clusters"),
output, new EuclideanDistanceMeasure(), 0.001, 10,
true, 0.1, true);