Eike Ziller

Qt Creator 4.8 Beta released

Published Thursday October 11th, 2018
30 Comments on Qt Creator 4.8 Beta released
Posted in Dev Loop, Qt, QtCreator, Releases

We are happy to announce the release of Qt Creator 4.8 Beta!

languageclient_py_hs

Generic Programming Language Support

In Qt Creator 4.8 we’ll introduce experimental support for the language server protocol. For many programming languages there is a “language server” available, which provides IDEs with a whole lot of information about the code, as long as they support communicating via the protocol.

This means that by providing a client for the language server protocol, Qt Creator gets (some) support for many programming languages “for free”. Currently Qt Creator supports code completion, highlighting of the symbol under cursor, and jumping to the symbol definition, as well as integrates diagnostics from the language server. Highlighting and indentation are still provided by our generic highlighter, since they are not provided via the language server protocol.

To use a language server, you first need to enable the LanguageClient plugin in Help > About Plugins (Qt Creator > About Plugins on macOS). Then add the server in Tools > Options > Language Client, choosing a MIME type (glob patterns are in the works), server executable and any required command line arguments. The server is automatically started – just open a file of the corresponding type and start hacking :).

Note that the client is mostly tested with Python. There will most probably be one or the other issue when you try your most favorite language. Also, we currently do not support language servers that require special handling. If you find issues, we are happy to receive bug reports, preferably including Qt Creator console output with the environment variable  QT_LOGGING_RULES=qtc.languageclient.*=true set.

C++ Support

On the C++ side we added some experimental features.

Compilation Database Projects

Open a compilation database as a project purely for editing and navigating code. A compilation database is basically a list of files and the compiler flags that are used to compile them. Some build systems and tools are able to generate such databases for use in other tools. In Qt Creator it feeds the code model with the necessary information for correctly parsing the code. Enable the plugin CompilationDatabaseProjectManager to try it.

Clang Format Based Indentation

Does auto-indentation via LibFormat which is the backend used by Clang Format. Enable the plugin ClangFormat to try it.

Cppcheck Diagnostics

Integrates diagnostics generated by the tool Cppcheck into the editor. Enable the plugin Cppcheck to try it.

Aside from many other fixes, the Clang code model can now jump to the symbol represented by the auto keyword. It also allows generation of a compilation database from the information that the code model has via Build > Generate Compilation Database.

Debugging

We added support for simultaneously running debuggers on one or more executables. When multiple debuggers are currently running, you can switch between the instances with a new drop-down menu in the debugger tool bar in Debug mode.

There have been many more improvements and fixes in Qt Creator 4.8, which you can read about in more detail in our change log.

Get Qt Creator 4.8 Beta

The opensource version is available on the Qt download page, and you find commercially licensed packages on the Qt Account Portal. Qt Creator 4.8 Beta is also available under Preview > Qt Creator 4.8.0-beta1 in the online installer. Please post issues in our bug tracker. You can also find us on IRC on #qt-creator on chat.freenode.net, and on the Qt Creator mailing list.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Dev Loop, Qt, QtCreator, Releases

30 comments

Benjamin says:

Cool. Does this mean, that – in future – it might be possible to have basic c# or Rust-Support?

Eike Ziller Eike Ziller says:

In principle yes. It depends a bit on the specific language server implementation for that language though. Some require custom setup and/or do not behave quite according to standard, so these will not work out of the box without language specific, custom code in Qt Creator.

Benjamin says:

Thanks for the quick reply.

vidya says:

oh sweet jesus, please guys add Rust support. i need it in my life, currently the only rust ide that doesn’t completely suck dick is vscode but it just blows compared to mighty creator.

Vil says:

The change log link appears to point to the changes in 4.7. I think the url should be https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist/changes-4.8.0.md ?

There are still some serious problems with the CDB debugger support in 4.7, where the debugger actually displays incorrect information:

https://bugreports.qt.io/browse/QTCREATORBUG-21074
https://bugreports.qt.io/browse/QTCREATORBUG-20639

I don’t see these mentioned in the change log yet. Is there any chance they’ll be fixed for the 4.8 final release? It’s a bit scary debugging when you can’t trust what the debugger is telling you…!

Lest I sound too negative: I still think QtCreator is the best IDE out there and I really appreciate all the work that goes into it. The new language server support is exciting – I’m looking forward to trying it out with Rust – and I really like that make will run in parallel by default now too.

Eike Ziller Eike Ziller says:

Link fixed, sorry!

Vil says:

It looks like one of those bugs has already been fixed too – amazing!

Troll says:

But does it support multiple cursors yet?

Jakub says:

Yeah, I can’t wait for this feature too. Please vote for it here: https://bugreports.qt.io/browse/QTCREATORBUG-16013

But also…if there will be QML support in Language Server Protocol, then I think we could use CLion, Sublime or another tool for development 🙂

aportale says:

The QML language server will come: https://bugreports.qt.io/browse/QTBUG-68406 Of course, you are still welcome using it from Qt Creator, even if the multiple cursors are still missing 😉

Ivan says:

Is there c++17 support?

Eike Ziller Eike Ziller says:

The Clang code model supports C++17, yes.

Ivan says:

How to enable it? Adding
CONFIG += c++17
is apparently not enough.

Ivan Donchevskii Ivan Donchevskii says:

It depends on your compiler because ClangCodeModel tries to pick the version closest to one which you are compiling with. If CONFIG does not work (it depends on qmake) you can try to use QMAKE_CXXFLAGS += -std=c++17, it should also be picked up by ClangCodeModel.

Eike Ziller Eike Ziller says:

Qmake wants “CONFIG+=c++1z” instead, I think

arturo182 says:

Should Python also highlight all occurrences of a variable like the Haskell example in the screenshot? Because I couldn’t get it to do that, the auto completion also seems to suggest all variables in the file, not just the ones that make sense for the current scope. Here’s my config: https://i.snag.gy/uGOmqn.jpg Maybe a tutorial would be useful 🙂

Otherwise, this is great job and a step in the direction to have the best IDE in the world also support Python!

Eike Ziller Eike Ziller says:

It should, and here it does. You need to install it with “pip install python-language-server[all]” though (well, possibly a subset is enough, but I wouldn’t know which). I’ve seen on a Windows machine that there python simply didn’t report any occurrences back. The log with “QT_LOGGING_RULES=qtc.languageclient.*=true” might give further hints.

Loïc says:

I tired to generate a compilation database with QtCreator and it is very verbose (~50 line per file). But all files in a given project usually have the same settings. Wouldn’t be possible to simply have a way to set compilation flags globally for a given project ? (Currently only -W option can be set globally)

Also it seems to add a ‘-D’ line for each macro I have defined in my project.config file and a ‘-include project.config’. The ‘-include’ option should be enough, no need to add the -D option.

Ivan Ivan says:

The way compilation database is structured is that you have all that duplication, we just try to follow documentation. We basically handle all flags and defines from you project and put them in this file because they can all affect the parsing.

tr3w says:

Is this language server support is the first step towards clangd?

Ivan Ivan says:

You can already start experimenting with it – we have clangd shipped together with Qt Creator – it’s in bin\clang\bin

tr3w says:

Do you think that is the future, and QtCreator will drop the direct us of the clang code model, or it is too early to know that?

Eike Ziller Eike Ziller says:

Currently neither the language server protocol nor clangd support semantic highlighting (yet?). I’d say it’s too early to know, but worth keeping an eye on.

nurupo says:

Since you have added cppcheck static analyzer support, how about adding support for clang’s scan-build (assuming it’s not supported yet)?

Also, these tools often tell you the code paths that they found the issues at, giving you a full walk-through for them, like this https://i.imgur.com/VF0W3PI.png That’s an HTML output clang’s scan-build generates. Would be nice to have that information embedded into Qt Creator, i.e. be able to select a specific issue scan-build found and have those code path walk-thoughts show up in the code editor. If that’s too much to ask for, just opening a WebView tab in QtCreator that displays the generated by scan-build HTML is fine too.

aportale says:

If you mean the Clang Static Analyzer, you can find it integrated as a clang-tidy check option under the Clang tools: https://doc.qt.io/qtcreator/creator-clang-tools.html . It is not displayed displayed inline in the code editor, but instead in the result window. You will see the code path in textual form, and you can click to jump to the different stations of the paths.

vincent says:

Hello,
Can you help me the details of configuration to use the python language server as in screenshot. I tried and cannot make it work yet.
PS: I am using Mac

Eike Ziller Eike Ziller says:

Possibly there are other ways, but here’s at least one way:

Get a Python installation with “pip”. The system Python does not by default come with it. IMO the easiest is to use Homebrew https://brew.sh , which will also get you a Python3 instead of 2.7. After installing brew:

“brew install python”
“pip3 install –upgrade pip”
“pip3 install python-language-server[all]”

In Qt Creator add a language server entry, MIME type “text/x-python”, executable “/usr/local/bin/pyls”, arguments stay empty.

Liang Jian says:

Can somebody take a look at https://bugreports.qt.io/browse/QTCREATORBUG-20609, That is a serious regression introduced in 4.6 and still reproducable in qtcreator 4.7.1. Thanks!

ekke ekke says:

all the new stuff is really cool.

unfortunately one of the most important features (code completion) still has errors and without working code completion the fun factor goes down

again getting QML Import Path not found errors and have to switch to desktop which most times work, but Android or iOS getting the error – not always, but many times. it’s annyoing to switch between platforms to get the code completion in QML.
(see https://bugreports.qt.io/browse/QTCREATORBUG-20195)

next part where my code completion isn’t working as expected if some projects are open with same C++ Class names. doesn’t matter if set as context property or QmlRegisterType. Creator doesn’t differentiate between the projects – the first one wins. Have to restart QtCreator to get the correct code completion.
(see https://bugreports.qt.io/browse/QTCREATORBUG-20211)

Slava says:

Great news! Did you guys consider rebranding? Like a CodeCreator or something like that, cause I know a lot of people who are freaked out by the Qt in the name of IDE. And now with the support for so many other languages I think the name is even more misleading.

Commenting closed.

Get started today with Qt Download now