How can I add a *.hx file support in opengrok? - opengrok

I have a legacy C project which is using *.hx as a customized header file suffix. I'm trying to using opengrok to read the code. But it doesn't support this file extension.
I tried to modify the SUFFIX in
OpenGrok-0.12-stable\src\org\opensolaris\opengrok\analysis\c\CAnalyzerFactory.java
and compile to get the opengrok.jar
but it doesn't help.

Check the CLI options to opengrok.jar, especially the -A option.

Related

grpc-gateway runtime version conflict

from last few days the protoc generator is generating code with v2 version of github.com/grpc-ecosystem/grpc-gateway. I want to keep using github.com/grpc-ecosystem/grpc-gateway v1.16.0. I am unable to remove the v2 version which is causing conflict. I tried removing from go.mod, clearing from $GOPATH. I suppose my protoc generator is not able to use v1 version. Kindly guide me as how shall I sync the grpc-gateway runtime package.
Using below commands to generate the messages and service
protoc -I . --go-grpc_out=. api/protobuf-spec/catalog_fetch/*.proto
protoc -I . --grpc-gateway_out=logtostderr=true:. api/protobuf-spec/catalog_fetch/*.proto
Note: It is generating both grpc.pb.go file and pb.go file, which is further causing issue.
cannot use mux (type *"github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMux) as type *"github.com/grpc-ecosystem/grpc-gateway/v2/runtime".ServeMux ```
I have spent 3 hours debugging the exact same problem.
You have to remove the binary from your GOPATH and GOROOT.
For simplicity, just use which protoc-gen-grpc-gateway.
This should point you to the binary protoc is using under the hood. Remove it and rerun go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway#v1.16.0.
I think you have installed the v2 version of the generator. Unfortunately, you cannot use v1.16.0 with newer versions of the go protobuf generators. If you want to keep using v1.16.0, you can download the generator from the releases page https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.16.0.

VS Code, format HTML code with Twig or Swig tags

Is there a way to format correctly HTML in VSCode when we use Twig or Swig tags, like
{% if ... %} {%else%} {%endif%} {% for %} {%endfor%} {% include %}, etc...
For now code formatters remove all line breaks before and after those tags.
Was not able to find an suitable extension for that.. Neither a way to configure the internal code formatter.
I had the same problem and solved installing this extension:
Twig Language
Install it, restart the editor and ff you are on windows you can format with standard ALT + SHIFT + F.
Hope it helps.
I've been struggling SO MUCH with this, and finally found a fully working solution; so wanted to share it here. Follow the steps below and you should be good to go:
Download the Vs Code Extension Prettier Code Formatter. Pay close attention to grab this Prettier Package, as Visual Studio proposes several different Prettier Extension Packages.
In the Visual Studio Editor, go to Settings --> type "format" until the formatting settings pop up, and then select Prettier Code Formatter - esbenp.prettier-vscode as your default formatter. Do this for both the User as well as the Workspace tab, if not automatically done.
Next, you'll need to add the melody plugin used for the proper formatting of twig files using Prettier in Vs Code. This is actually a nodejs package, so you first need to install Node JS. It can occur that you will run into permission issues when installing node packages later on. To try to avoid this at max, install node using a nvm.
Now you can install the melody plugin. To do so, follow the instructions of the linked repository. Note that you previously need to install yarn if you don't have it already installed, via npm install --global yarn.
To hold project-specific formattings within your github repo / project, you can add a .vscode/settings.json file which holds the general prettier configs you're currently using in your project. That's pretty useful to share the prettier formatting settings across developers / repos.
Also add the .prettierrc file to your projects root, with the following content:
{
"printWidth": 80,
"tabWidth": 4,
"plugins": ["./node_modules/prettier-plugin-twig-melody"]
}
This defines the additional use of the above-mentioned plugin. You may adapt the configs according to your needs. You can either put your node_modules folder holding the package within it into your local project, or adapt the path as needed to wherever your melody plugin is located on your local machine.
FYI: The node_modules folder is normally not uploaded to project repos due to its size. Once you install node, you will automatically get that node_modules folder on your local machine. And when you then install the above-mentioned package, it should get installed into that node_modules folder.
Now add the Twig Syntax highlighting package from whatwedo. Now, VS Code should recognize Twig files when you open them. Verify this by opening a .twig file within VS Code and checking in the bottom right corner that the file is recognized as HTML (Twig). This will additionally highlight your swig tags.
To verify that everything's working properly, you can open the prettier terminal by clicking on Prettier at the bottom right in your VS Code. Now write some twig content into a .twig file and trigger the formatter. If no errors were reported in the console, and the console informs that the melody plugin is used for formatting; and of course the code has been properly formatted; you're good to go.
There is a built-in way nowadays; when you try to format a document you get forwarded to the extension page and a search for a formatter for a given file format. For Twig:
category:formatters twig
Twig Language 2 seems to be the go-to VS Code Twig extension with the best formatter as of now.
Something related to this, i did it by installing twig in vs code.
Open VS Code and
Ctrl+Shift+X
And get the twig extension and install it. Thanks.

Pass file name to build script in PhpStorm

I have the next configuration for a build system in PhpStorm:
And it works ok, but I have a problem... my build script needs to receive the name of the file I'm running it on, so, if I build a PHP file, it will run phpcs on it, but if I'm building a CSS or JS file, it will run gulp... with Sublime Text that is possible, is it possible with PhpStorm?
There are no macros support for Run/Debug Configurations -- they are made so they do not depend on a context (currently opened file in editor). In other words -- they are pretty static and all file names/paths are basically hard coded.
For what you are describing (build script).. you need to use External Tools functionality (which can have all of that and made specifically for such tasks). Once created, you can assign custom shortcut to any External Tools entry (check Settings/Preferences | Keymap for that) so it's more convenient to use it.
If you want such script to be called on every file save automatically -- then use File Watchers -- pretty much external tools that will be called for you automatically (once per each file modified).
Since you are doing this for a build script -- maybe you should try to use dedicated (and therefore more appropriate in general) tools? For example: Gulp / Grunt .. or even Phing.
Create external tool:
https://www.jetbrains.com/phpstorm/help/external-tools.html
You can assign hotkey to execute your build command.

Install {{listen}} template on Mediawiki?

I have installed MediaWiki and I would like to use the {{listen}} template as one can do on Wikipedia.
I tried copying the {{Template:Listen}} and {{Module:Listen}} pages onto my wiki, but it doesn't give any result as the pages are interpreted as text (while {{Module:Listen}} is code (Lua?)).
What should I do to get this to work?
You need to install the extension Scribunto, to be able to use Lua. In recent MW versions, the extensions is already bundled, and all you have to do is
require_once "$IP/extensions/Scribunto/Scribunto.php";
Otherwise download it and put it in your extensions directory first.
If that doesn't work, you might have to use another version of Lua than the one bundled with the Scribuntu extension (this will depend on your server). See instructions on http://www.mediawiki.org/wiki/Extension:Scribunto on how to do this. In short: Install Lua on your server, set $wgScribuntoEngineConf['luastandalone']['luaPath'] to the path of your Lua binaries, and add $wgScribuntoDefaultEngine = 'luastandalone'; after the require_once line.

How do I include configuration files with Maven Appassembler?

I'm using the Maven Appassembler plugin to package my application. I'd like to package some configuration files with the application. I've found the configurationDirectory and includeConfigurationDirectoryInClasspath parameters, but I haven't found how I should create (and populate) that configuration directory. I've tried putting the files in src/main/resources, but that just puts them in the jar file for my project.
What is the "proper" way to do this, using maven?
Unfortunately this is a limitation of the appassembler plugin in the current release version. Typically, the plugin is used in conjunction with the assembly plugin to produce the final artifact, in which you can include the reference to your configuration directory. However, if you'd like to have a functional structure from just the appassembler plugin you need to manually copy the files into place. An example using the antrun plugin with a src/main/conf directory can be found here: http://svn.apache.org/viewvc/archiva/trunk/archiva-jetty/
By default, the plugin uses the directory src/main/config.
Is possible to change the source for the config files using the parameter <configurationSourceDirectory>src/main/config</configurationSourceDirectory>
When I include the copyConfigurationDirectory property, it copies the config files and bundles them properly.
<configurationDirectory>etc</configurationDirectory>
<configurationSourceDirectory>src/main/config</configurationSourceDirectory>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
I have a different problem though. I would like to filter my config files before copying, which is giving me some trouble.
Apart from that is does not generate the bin scripts for different platforms. The maven-assembly-plugin can create (package(s) {tar.gz, zip}) for distribution. These are configured through a assemble.xml. You specify which files go in (with what options (chmod)), etc. It can also filter files (search/replace values within them). etc.
Years later and in version 1.10 of the plugin there is now a preAssembleDirectory configuration option. Unfortunately I don't find it flexible enough for my needs because it copies directly into assembleDirectory and does not allow to specify a target directory path within assembleDirectory.