How to set up code formatting in Kdevelop with clang-format? - clang-format

I'm trying to set up code formatting in Kdevelop 5.4.5. I click on Settings > Configure KDevelop > Source Code Formatter. In the Formatter dropdown I select Custom Script Formatter, select Clang Format in the options listbox, then click on the New button.
When I go to edit my newly created formatter, this is displayed:
I tried running the "command" in the project's root directory, but nothing happens.
How do I create my own formatting style in KDevelop using clang-format?

There are bugs. Add parameter -style=file, after add your own .clang-format file in project root directory and add "$FILE" at the end of command line and it will work, but soon you will discover new problems, for example with headers.
Use external scripts window in KDevelop. Call clang-format with your own parameters, add hotkey for it and be happy.

Related

Spell check for latex file in Atom

I am trying to add .tex file in the Setting->Grammar of atom/spell-check so that it will check spellings in my document because .tex file is going to be a PDF document, but its not working.
Found out that I was using wrong syntax. Correct scope is text.tex.latex. It was already mentioned in the README file on how to get it. Follow below procedure in Atom Editor.
To enable Spell Check for your current file type: put your cursor in
the file, open the Command Palette (cmd-shift-p), and run the
Editor: Log Cursor Scope command. This will trigger a notification
which will contain a list of scopes. The first scope that's listed is
the one you should add to the list of scopes in the settings for the
Spell Check package. Here are some examples: source.coffee,text.plain, text.html.basic.
It should pop up as below

No permission to use getFileById in google spreadsheets

I have following problem.
I have two files:
Source file - https://docs.google.com/spreadsheets/d/15zIdIeYFlca-SQ0ryl89oX_tbGjO_6cipqHkkxog7ho/edit#gid=0
Target file - https://docs.google.com/spreadsheets/d/1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0/edit#gid=0
In the source file there is a script (function is named onEdit triggered with onEdit event). When you change the value of R3 cell (Source File) to other "Advisor" whole row should be copied to target file, but sometimes it works, sometimes not. If you change the value of advisor field once and it works try couple of times more and for sure there will be a problem with permission in a while.
When it's not working I get msg that there is problem with permission of executing function called getFileById, which is used in following line:
var file = DriveApp.getFileById('1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0');
Any ideas what to do to solve the problem and why sometimes it works fine ?
Scripts using a 'simple' trigger can modify the file they are bound to, but cannot access other files because that would require authorization.
See here to learn more about the restrictions on simple triggers.
You can make sure you have all the permissions following the next steps:
Open the script project. At the left, click Project Settings
Select the Show "appsscript.json" manifest file in editor checkbox.
At the left, click Editor <>.
At the left, click the appsscript.json file.
Locate the top-level field labeled oauthScopes. If it's not present, you can add it.
The oauthScopes field specifies an array of strings. To set the scopes your project
uses, replace the contents of this array with the scopes you want it to use. For
example:
{"oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.readonly", "https://www.googleapis.com/auth/userinfo.email"], }
Retrieved from: https://developers.google.com/apps-script/concepts/scopes

Syntax Highlighting Guide for Atom

I am very pleased with the new editor by Github. Unfortunately it isn't exactly easy to customize it. I wanted to create my own Syntax Highlighting Theme, because I am not happy with the ones available to download (at least they don't seem to do well with Java)
Now the files (syntax-variables, color.less, etc.) to style seem to be in:
~/.atom/ .../packages (if you want to change existing themes)
The problem is just that I don't know which (CSS) classes style which elements of the syntax. Is there a place where I can look up how to change the color of for example variable type declarations?
Yes, you can start Atom in Developer Mode by using the command atom --dev or by using the menu View > Developer > Open in Dev Mode .... When you do that you can right click on any element in the UI and select Inspect Element from the context menu, just like you would in your web browser.
Additionally, for syntax elements you can:
Put your text cursor on the item you want to style
Press Cmd+Alt+P on OS X, Ctrl+Alt+Shift+P on other platforms, or find "Editor: Log Cursor Scope" in the command palette to display the scopes of the syntax element
The scopes of the syntax element translate directly to CSS classes.
You can use chromium web-console by pressing Ctrl+Shift+I (tested in linux) and highlighting any element. After then open your stylesheet by pressing Edit->Open Your Stylesheet and add style for element with LESS syntax.
For example:
You want bold highlighting class and function name. If you select class with chromium-console you can see that it have class .name
That you should add in you Stylesheet file something like this:
atom-text-editor::shadow .name{
font-weight: bold
}
And you may create you own theme. In Atom it's not difficlt - press Ctrl+Shift+P and type "Generate Syntax Theme". In new theme you can copy some code from other theme. If you don't know CSS/LESS - don't worry! Your new theme have file in style folder named colors.less. You can change it or write new color rule on base.less file.
Atom have awesome doc, you can read about creating theme in this page https://atom.io/docs/v1.4.2/hacking-atom-creating-a-theme
For others that come here because the highlighting for a filetype is not recognized for your language:
open the ~/.atom/config.cson file (by CTRL+SHIFT+p: type ``open config'')
add/edit a customFileTypes section under core for example like the following:
core:
customFileTypes:
"source.lua": [
"conf"
]
"text.html.php": [
"thtml"
]
(You find the languages scope names ("source.lua", "text.html.php"...) in the language package settings see here)
Go to Install -> search for the package -> select the package -> click install button

Add translation using PoEditor

I have files named en_US.po, ru_RU.po etc.
Editing *.po files in PoEdit is very useful, but not while adding new strings manually.
How can I easily add new translation strings which are not automatically detected by PoEdit?
You can edit *.po files in any text editor and then in POEdit generate *.mo file
You misunderstand how gettext translations work. Source strings for translation are extracted from source code. It doesn't make sense to add them manually — they would never be used if they didn't have corresponding source code that uses them.
So the way to add strings is to use xgettext or Poedit's update from sources functionality.
P.S. The name's Poedit, not PoEditor.
You can configure your project (*.po file) opened in PoEdit. If you will done that correct PoEdit automatically update what to translate in this opened *.po file.
First of all, open *.po file which you want update with strings to
translate.
Go to Catalog -> Properties then to Source Paths tab
Add paths where PoEdit should look for source files in Your applilcation. More universal is to use relative to opened *.po file main path. If you have typical zf2 skeleton application folder structure you can add ../../.. for main path and add one module path.
Then go to Source of keywords tab and add translate and if you're using zf2 forms it is useful to add addLabel keyword (PoEdit will scan sources for this functions and add string parameters from them to your *.po file, as string to translate)
Next open Edit -> Preferences and in Processing programs tab, edit PHP section and add *.phtml extension (this will be scanned by poedit also)
After that you have to click in Update button and PoEdit will start scan your sources for strings to translate. Then you only have to do is translate found strings.

Does Texniccenter or any other tex editor auto-complete references in Latex?

I want to use a latex editor that has auto completion feature for existing references in a latex file. Do you know any good ones? I am trying to find this feature in texniccenter, but I guess it doesn't exist or I could't find it yet.
Update:
Ok, I found how to enable auto completion in Texniccenter. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Texlipse does this, also with Ctrl+Space.
Inlage includes such a function, too. New commands and new environments will also appear in the auto completion list. If you use extern BibTex files the \cite{} command will open a list with your articles and books from you .bib file.
Ok, I found it. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Kile has reference completion. If you type Ctrl+Space inside of a \ref{}, you get a list of all the references (that existed last time you compiled, of course).
LEd presents a click list of them when in a \ref{}
The RefTeX mode for Emacs will do what you're asking for: the shortcut C-c ) activates the "insert a \ref" mode (of course, you can customize which type of reference: fancyref, hyperref, etc) and pressing TAB will allow you to start typing and autocomplete by tabbing again after typing some characters.
It also figures out (or asks if it can't) what sort of ref you're inserting and shows a list of all the defined \labels in your document, selectable with the arrow keys or C-n / C-p.
Now we just need a Vi user to come along and tell us how to do it there...
Now texmaker does, not need any special key.

Resources