Atom Grammar Detector - atom-editor

I routinely have to pipe files with no file extension into Atom for editing. The Atom grammar-selector core package allows me to change the grammar relatively easily. I'm wondering 2 things:
Can I make this package always fallback to something other than plaintext?
Is there a way that the filetype's grammar can be detected without a file extension? In my case, the files are always YAML. Seems that there could be a grammar-detector pkg that tries to determine the grammar from the file content rather than just a file extension.
Any ideas?

Related

How to create and modify .doc and .docx file in Qt?

I want to create and modify .doc and .docx file in Qt creator with ability to compile for Windows, Linux, Android and IOS.
This is not a Qt-specific question imho. Anyhow here is my answer:
Quoting wikipedia:
is a zipped, XML-based file format
What this means is you need to decompress (you need to figure out how it is compressed to begin with) and process the XML for doc files. Qt provides basic (de)compression facilities and does provide the tools to process XML data.
In terms of Qt Creator - you have to write your own plugin for that purpose. You can check what's already there - processing of CMake, C++, C, Python files.
You should use what's already there. LibreOffice for example, which is open source and free, can handle such documents (incl. doc). There are libraries that do that too. So your best bet is to integrate some library into your Qt application. I would NOT recommend implementing it yourself unless you have a lot of spare time. The fact that big projects such as LibreOffice, OpenOffice etc. still don't have 100% support for such documents should give a big enough hint that it's not a trivial task.

Opening/Editing Qt Resource File (.rcc)

I want to translate a program; but its language files (.qm) are in a .rcc file.
The program is not mine, so I haven't got any .qrc file.
Before asking this question, I have searched this site about this issue; but I don't attain anything.
Is there any way to extract/decompile it?
You can take my tool RccExtended - it based on the official Qt resource compiler with additional function to decompile binary resources.
Usage example:
cd \Path\To\MyQtResources\
rcc --reverse
Decompiler will unpack all .rcc files in the current directory, generate .qrc files and make.bat file to compile resources back to the binary format.
There isn't a supported way to decompile it as far as I'm aware, but it's a binary file format that can be read and handled. There's a nodejs example of how to read the file and extract PNGs on github: https://github.com/gcochard/png-extractor. It may be possible to extend that method out for the .qm files.
However there's other issues with attempting to add more translations to a Qt application without having the code, depending on the language you're attempting to add, how the developer has exposed the other languages etc.

automatically compile less file on save of a imported less file

I have split my less/css into several files grouped by certain categories, so the single files stay easy to maintain. Though I only want to have one css file which gets imported into the layout.
For this I have - how I call it - a master less file which imports all the others like config, forms, layout and so on.
Now the problem is, that for example WinLess or all the other copilers i tried, only monitor the save of my master file, and only then compiles it. However this is stupid, because this file nearly never gets any changes. So what I would like to have is something, that detects changes on the imported less files and then only compiles the master file.
Does anyone know any tools, which are capable of that?
Or how do you manage your less files to bypass this problem?
Further Info: I have mapped the server directory locally via SSH and edit the files in there, i.e. the files are only pseudo local. They are on the server but accessible with a local path over a drive letter. The compiler should be able to work with that setup.
Thanks for the answers!
In all honesty, your best bet is to actually use Less's own compiler which will of course be the most up to date option. It will be done through command line but it's the best way to know that everything is correct, working and up-to-date.
All the information can be found in the Less Documentation Here
More information about compiling with imports can be found HERE
The latest version of WinLESS does report that it has automatic re-compiling when an #import file is changed so it could be that your version of WinLESS is out of date. (See HERE - 3rd bullet point under Features)
Alternatively, see if you can get it to work on purely local files. If this works, it may be an issue with the compiler not being able to do asynchronous checks over SSH.
I use Notepad++ with the NppExec-plugin on-save script. If you make a convention decision to always name your primary file "master.less" you can use this script:
NPP_CONSOLE 0
NPP_SAVE
if $(EXT_PART) != .less goto end
"C:\Node.JS\node_modules\.bin\lessc.cmd" -x "$(CURRENT_DIRECTORY)\master.less" > "$(CURRENT_DIRECTORY)\master.min.css"
:end
You can do something similar with any editor that supports batch scripting (like Stewartside suggests)

Can the GitHub Atom editor show properties and functions of classes?

Recently I moved from NetBeans to GitHub Atom editor. How can I access properties and functions of classes in the editor?
I use a mix with the symbol gen and symbols view packages. First one very good about generating ctag file for your project and second one for inspect code and jump to the definitions of tags. Also, it supports Show all symbols in current file future. It have to show for you the members and properties of your classes.
In short: after installation open a work directory with your project and try alt + cmd + g, wait several seconds, ctags file generating now for you and after that cmd + r and just start typing any part of a method or property in the input.
In addition to all the previous answers, I would recommend you to check Atom's package goto-definition, with its optional "performance mode" (which requires you to install ripgrep).
goto-definition will allow you to find and access properties and
functions/classes definitions even if they are not written in the same file. In combination with ripgrep, goto-definition is extremely fast, and you will not have to wait for file indexing within your project.
If you are referring to the members of a Java class (which I assume, since you've used NetBeans before), then this is currently not supported in Atom.
Atom is a (fairly simple) editor that allows you to edit text files, while full-blown IDEs (Integrated Development Environments) like Eclipse, NetBeans or IntelliJ IDEA have full language support including running, debugging and browsing Java class information. It might be better to stick with one of the IDEs I mentioned if you are looking for this kind of functionality.
Having said that, there's the https://atom.io/packages/atom-ctags package, which supposedly can show some meta information about classes you're working on. It's primarily for C++, although it might work for Java as well (I haven't tried).

How to automatically add header files to project?

How would I go about having a CMake buildsystem, which scans for source files now using AUX_SOURCE_DIRECTORY, scan for header files too in the same directory, preferably using a similar command?
I didn't find an easy way to do this in the documentation yet, so I now have a crappy bash script to post-process my (CodeBlocks) project file...
You can use the file(GLOB ... ) command. For example:
set(dir my_search_dir)
file (GLOB headers "${dir}/*.h")
message("My headers: " ${headers})
This command can also recurse, and list your files relative to a given path. See the "file" command entry in the cmake doc.
The documentation to AUX_SOURCE_DIRECTORY suggests that it was not intended to be used that way, so I'd rather doubt that what you're asking is possible. If you want an authoritative answer, you can reach the CMake developers at cmake#cmake.org (they're actually very nice to deal with).
I'd recommend strongly against using wildcards to specify what is included in the build. The build files should specify the exact contents of the libraries, and not depend on what happens to exist in the directory. It may be cumbersome at first (if you're used to wildcards, or IDE's which works the same way), but when you get used to it, you don't want to have it any other way.

Resources