Merge remote-tracking branch 'origin/14.0'

Change-Id: I240ecca23ec82e54699fcf11ba1d801d0a8c09f0
This commit is contained in:
Eike Ziller
2024-06-14 11:27:59 +02:00
127 changed files with 1745 additions and 975 deletions

View File

@@ -9,7 +9,7 @@ on:
env: env:
QT_VERSION: 6.7.1 QT_VERSION: 6.7.1
MACOS_DEPLOYMENT_TARGET: 11.0 MACOS_DEPLOYMENT_TARGET: 11.0
CLANG_VERSION: 18.1.5 CLANG_VERSION: 18.1.7
ELFUTILS_VERSION: 0.175 ELFUTILS_VERSION: 0.175
CMAKE_VERSION: 3.21.1 CMAKE_VERSION: 3.21.1
NINJA_VERSION: 1.10.2 NINJA_VERSION: 1.10.2

View File

@@ -1129,7 +1129,7 @@ function (add_qtc_lua_plugin name)
qtc_copy_to_builddir(${name} qtc_copy_to_builddir(${name}
FILES ${_arg_SOURCES} FILES ${_arg_SOURCES}
DESTINATION ${IDE_PLUGIN_PATH}/lua-plugins DESTINATION ${IDE_PLUGIN_PATH}
) )
if (NOT _arg_EXCLUDE_FROM_INSTALL) if (NOT _arg_EXCLUDE_FROM_INSTALL)
@@ -1138,7 +1138,7 @@ function (add_qtc_lua_plugin name)
install( install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE} FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
DESTINATION ${IDE_PLUGIN_PATH}/lua-plugins/${SOURCE_DIR} DESTINATION ${IDE_PLUGIN_PATH}/${SOURCE_DIR}
) )
endforeach() endforeach()
endif() endif()

View File

@@ -7,7 +7,7 @@ instructions:
variableValue: "RelWithDebInfo" variableValue: "RelWithDebInfo"
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: LLVM_BASE_URL variableName: LLVM_BASE_URL
variableValue: https://ci-files02-hki.ci.qt.io/packages/jenkins/qtcreator_libclang/libclang-release_18.1.5-based variableValue: https://ci-files02-hki.ci.qt.io/packages/jenkins/qtcreator_libclang/libclang-release_18.1.7-based
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: QTC_QT_BASE_URL variableName: QTC_QT_BASE_URL
variableValue: "https://ci-files02-hki.ci.qt.io/packages/jenkins/archive/qt/6.7/6.7.1-released/Qt" variableValue: "https://ci-files02-hki.ci.qt.io/packages/jenkins/archive/qt/6.7/6.7.1-released/Qt"

View File

@@ -13,6 +13,8 @@ the public Git repository. For example:
General General
------- -------
* Started work on supporting Lua based plugins (registering language servers,
actions, preferences, and wizards)
* Added `Clear` and `Save Contents` to context menus of all output views * Added `Clear` and `Save Contents` to context menus of all output views
* Locator * Locator
* Added the option to show results relative to project root * Added the option to show results relative to project root
@@ -54,17 +56,22 @@ Editing
([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279)) ([QTCREATORBUG-10279](https://bugreports.qt.io/browse/QTCREATORBUG-10279))
* Clangd * Clangd
* Increased the minimum version to LLVM 17 * Increased the minimum version to LLVM 17
* Added an option for the index location * Added the `Per-project index location` and `Per-session index location`
options in `Preferences` > `C++` > `Clangd` for setting the index location
for a project or session
([QTCREATORBUG-27346](https://bugreports.qt.io/browse/QTCREATORBUG-27346)) ([QTCREATORBUG-27346](https://bugreports.qt.io/browse/QTCREATORBUG-27346))
* Made reparsing source files while editing header files optional * Added the `Update dependent sources` option to make re-parsing source files
while editing header files optional
([QTCREATORBUG-29943](https://bugreports.qt.io/browse/QTCREATORBUG-29943)) ([QTCREATORBUG-29943](https://bugreports.qt.io/browse/QTCREATORBUG-29943))
* Fixed the handling of system headers * Fixed the handling of system headers
([QTCREATORBUG-30474](https://bugreports.qt.io/browse/QTCREATORBUG-30474)) ([QTCREATORBUG-30474](https://bugreports.qt.io/browse/QTCREATORBUG-30474))
* Built-in * Built-in
* Added the option to disable the built-in indexer * Added the `Enable indexing` option in `Preferences` > `C++` > `Code Model`
to turn off the built-in indexer
([QTCREATORBUG-29147](https://bugreports.qt.io/browse/QTCREATORBUG-29147)) ([QTCREATORBUG-29147](https://bugreports.qt.io/browse/QTCREATORBUG-29147))
* Added an option for "statement macros" that are interpreted by the indenter * Added the `Statement Macros` field in `Preferences` > `C++` > `Code Style`
as complete statements that don't require a semicolon at the end for macros that the indenter interprets as complete statements that don't
require a semicolon at the end
([QTCREATORBUG-13640](https://bugreports.qt.io/browse/QTCREATORBUG-13640), ([QTCREATORBUG-13640](https://bugreports.qt.io/browse/QTCREATORBUG-13640),
[QTCREATORBUG-15069](https://bugreports.qt.io/browse/QTCREATORBUG-15069), [QTCREATORBUG-15069](https://bugreports.qt.io/browse/QTCREATORBUG-15069),
[QTCREATORBUG-18789](https://bugreports.qt.io/browse/QTCREATORBUG-18789)) [QTCREATORBUG-18789](https://bugreports.qt.io/browse/QTCREATORBUG-18789))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -162,7 +162,7 @@
\title Code Model \title Code Model
\brief Sets global preferences for the code model. \brief Sets global preferences for the C++ code model.
The code model offers services such as code completion, syntactic and The code model offers services such as code completion, syntactic and
semantic highlighting, and diagnostics. semantic highlighting, and diagnostics.
@@ -189,6 +189,10 @@
\li \uicontrol {Use built-in preprocessor to show pre-processed files} \li \uicontrol {Use built-in preprocessor to show pre-processed files}
\li Uses the built-in preprocessor to show the \li Uses the built-in preprocessor to show the
pre-processed source file in the editor. pre-processed source file in the editor.
\row
\li \uicontrol {Enable indexing}
\li Turns on the built-in indexer. Clearing this checkbox severely limits
the capabilities of the code model.
\row \row
\li \uicontrol {Do not index files greater than} \li \uicontrol {Do not index files greater than}
\li To avoid out-of-memory crashes caused by indexing huge source files \li To avoid out-of-memory crashes caused by indexing huge source files
@@ -243,9 +247,14 @@
version 14, or later. version 14, or later.
\li In the \uicontrol {Background indexing} field, select \uicontrol Off \li In the \uicontrol {Background indexing} field, select \uicontrol Off
to use a faster, but less accurate built-in indexer than the one used to use a faster, but less accurate built-in indexer than the one used
by default. You can set the indexing priority depending on whether by default. Set the indexing priority depending on whether
the accuracy of results or speed is more important to you during the accuracy of results or speed is more important to you during
global symbol searches. global symbol searches.
\li In \uicontrol {Per-project index location}, select the folder to
store the index files for each project. The \c {compile-commands.json}
file is also stored in this folder.
\li In \uicontrol {Per-session index location}, select the folder to
store the index files for each session.
\li In \uicontrol {Header/source switch mode}, select the C/C++ \li In \uicontrol {Header/source switch mode}, select the C/C++
backend for switching between header and source files. While the backend for switching between header and source files. While the
clangd implementation has more capabilities than the built-in clangd implementation has more capabilities than the built-in
@@ -254,6 +263,13 @@
\li By default, clangd attempts to use all unused cores. You can set a \li By default, clangd attempts to use all unused cores. You can set a
fixed number of cores to use in \uicontrol {Worker thread count}. fixed number of cores to use in \uicontrol {Worker thread count}.
Background indexing also uses this many worker threads. Background indexing also uses this many worker threads.
\li Select \uicontrol {Insert header files on completion} to insert
header files when completing symbols.
\li Select \uicontrol {Update dependent sources} to re-parse all source
files that include a header file when editing the header file. This
can cause a heavy CPU load if the header file is included in many
source files. Clear this option to only re-parse the source files
when saving the header file.
\li Set the number of \uicontrol {Completion results} if you regularly \li Set the number of \uicontrol {Completion results} if you regularly
miss important results during code completion. Set it to 0 to remove miss important results during code completion. Set it to 0 to remove
the limit on the number of completion results. Setting this to 0 or a the limit on the number of completion results. Setting this to 0 or a

View File

@@ -103,15 +103,182 @@
\li Create function declarations and definitions \li Create function declarations and definitions
\endlist \endlist
The following table summarizes the quick fixes for C++ code. The The following tables summarize the quick fixes available for C++ code,
fix is available when the cursor is in the position described in the according to the cursor position.
Activation column.
\section1 Block of Code Selected
\table
\header
\li Quick Fix
\li Description
\row
\li Assign to Local Variable
\li Adds a local variable which stores the return value of a
function call or a new expression. For example, rewrites:
\code
QString s;
s.toLatin1();
\endcode
as
\code
QString s;
QByteArray latin1 = s.toLatin1();
\endcode
and
\code
new Foo;
\endcode
as
\code
Foo * localFoo = new Foo;
\endcode
By default, \QC uses the \c auto variable type when creating the
variable. To label the variable with its actual type, select
\preferences > \uicontrol C++ > \uicontrol {Quick Fixes} and
clear \uicontrol {Use type "auto" when creating new variables}.
Also available for a function call.
\row
\li Extract Function
\li Moves the selected code to a new function and replaces the block
of code with a call to the new function. Enter a name for the
function in the \uicontrol {Extract Function Refactoring}
dialog.
\row
\li Extract Constant as Function Parameter
\li Replaces the selected literal and all its occurrences with the
function parameter \c{newParameter}, which has the original
literal as the default value.
\endtable
\section1 Class
The following quick fixes are available when the cursor is on the definition
of a class.
\table
\header
\li Quick Fix
\li Description
\row
\li Create Implementations for Member Functions
\li Creates implementations for all member functions in one go.
In the \uicontrol {Member Function Implementations} dialog,
specify whether the member functions are generated
inline or outside the class.
\row
\li Generate Constructor
\li Creates a constructor for a class.
\row
\li Generate Missing Q_PROPERTY Members
\li Adds missing members to a \c Q_PROPERTY:
\list
\li \c read function
\li \c write function, if there is a WRITE
\li \c {onChanged} signal, if there is a NOTIFY
\li data member with the name \c {m_<propertyName>}
\endlist
\row
\li Insert Virtual Functions of Base Classes
\li Inserts declarations and the corresponding definitions inside or
outside the class or in an implementation file (if it exists).
For more information, see \l{Insert virtual functions}.
\row
\li Move All Function Definitions
\li Moves all function definitions to the implementation file or
outside the class. For example, rewrites:
\code
class Foo
{
void bar()
{
// do stuff here
}
void baz()
{
// do stuff here
}
};
\endcode
as
\code
class Foo
{
void bar();
void baz();
};
void Foo::bar() {
// do stuff here
}
void Foo::baz() {
// do stuff here
}
\endcode
\row
\li Move Class to a Dedicated Set of Source Files
\li Moves a class to separate header and source files. For more
information, see \l{Move classes to separate files}.
\row
\li Re-order Member Function Definitions According to Declaration Order
\li Re-orders method definitions in a .cpp file to follow the order of
method declarations in the corresponding .h file.
\endtable
\section1 Class Member
The following quick fixes are available when the cursor is on a member
variable in a class definition.
\table
\header
\li Quick Fix
\li Description
\row
\li Generate Constant Q_PROPERTY and Missing Members
\li Generates a constant Q_PROPERTY and adds missing members
to it.
\row
\li Generate Getter
\li Creates a getter member function for a member variable.
\row
\li Generate Getter and Setter
\li Creates getter and setter member functions for a member
variable.
\row
\li Create Getter and Setter Member Functions
\li Creates either both getter and setter member functions for
member variables or only a getter or setter.
\row
\li Generate Q_PROPERTY and Missing Members
\li Generates a Q_PROPERTY and adds missing members to it.
\row
\li Generate Q_PROPERTY and Missing Members with Reset Function
\li Generates a Q_PROPERTY and adds missing members to it, with an
additional \c reset function.
\row
\li Generate Setter
\li Creates a setter member function for a member variable.
\endtable
\section1 Control Statement
\table \table
\header \header
\li Quick Fix \li Quick Fix
\li Description \li Description
\li Activation
\row \row
\li Add Curly Braces \li Add Curly Braces
\li Adds curly braces to an if statement that does not have a \li Adds curly braces to an if statement that does not have a
@@ -129,7 +296,10 @@
b; b;
} }
\endcode \endcode
\li \c if \row
\li Complete Switch Statement
\li Adds all possible cases to a switch statement of the type
\c enum.
\row \row
\li Move Declaration out of Condition \li Move Declaration out of Condition
\li Moves a declaration out of an if or while condition to simplify \li Moves a declaration out of an if or while condition to simplify
@@ -145,7 +315,192 @@
Type name = foo; Type name = foo;
if (name) {} if (name) {}
\endcode \endcode
\li Name of the introduced variable \row
\li Optimize for-Loop
\li Rewrites post-increment operators as pre-increment operators and
post-decrement operators as pre-decrement operators. It also
moves other than string or numeric literals and id expressions
from the condition of a for loop to its initializer. For
example, rewrites:
\code
for (int i = 0; i < 3 * 2; i++)
\endcode
as
\code
for (int i = 0, total = 3 * 2; i < total; ++i)
\endcode
\endtable
\section1 Function Declaration or Definition
\table
\header
\li Quick Fix
\li Description
\row
\li Add Definition ...
\li Inserts a definition stub for a function declaration either in
the header file (inside or outside the class) or in the
implementation file. For free functions, inserts the definition
after the declaration of the function or in the implementation
file. Qualified names are minimized when possible, instead of
always being fully expanded.
For example, rewrites
\code
Class Foo {
void bar();
};
\endcode
as (inside class)
\code
Class Foo {
void bar() {
}
};
\endcode
as (outside class)
\code
Class Foo {
void bar();
};
void Foo::bar()
{
}
\endcode
as (in implementation file)
\code
// Header file
Class Foo {
void bar();
};
// Implementation file
void Foo::bar()
{
}
\endcode
\row
\li Add \c Function Declaration
\li Inserts the member function declaration that matches the member
function definition into the class declaration. The function can
be \c {public}, \c {protected}, \c {private}, \c {public slot},
\c {protected slot}, or \c {private slot}.
\row
\li Apply Changes
\li Keeps function declarations and definitions synchronized by
checking for the matching declaration or definition when you
edit a function signature and by applying the changes to the
matching code.
When this fix is available, a light bulb icon appears:
\inlineimage icons/refactormarker.png
\row
\li Convert Function Call to Qt Meta-Method Invocation
\li Converts a normal function call into a meta method invocation, if
the function is marked as invokable.
\row
\li Move Definition Here
\li Moves an existing function definition to its declaration.
\row
\li Move Function Definition
\li Moves a function definition to the implementation file, outside
the class or back to its declaration. For example, rewrites:
\code
class Foo
{
void bar()
{
// do stuff here
}
};
\endcode
as
\code
class Foo
{
void bar();
};
void Foo::bar() {
// do stuff here
}
\endcode
\row
\li Move Function Documentation to Declaration/Definition
\li Moves the documentation comment for a function between its
declaration and definition.
\endtable
\section1 Identifier
\table
\header
\li Quick Fix
\li Description
\row
\li Add #include for undeclared or forward declared identifier
\li Adds an \c {#include} directive to the current file to make the
definition of a symbol available.
\row
\li Add Class Member
\li Adds a member declaration for the class member being
initialized if it is not yet declared. If \QC cannot
automatically detect the data type of the member, you
must add it.
\row
\li Add Forward Declaration
\li Adds a forward declaration for an undeclared identifier
operation.
\row
\li Convert to Camel Case
\li Converts a symbol name to camel case, where elements of the name
are joined without delimiter characters and the initial
character of each element is capitalized. For example, rewrites
\c an_example_symbol as \c anExampleSymbol and
\c AN_EXAMPLE_SYMBOL as \c AnExampleSymbol
\endtable
\section1 Numeric Literal
\table
\header
\li Quick Fix
\li Description
\row
\li Convert to Decimal
\li Converts an integer literal to decimal representation
\row
\li Convert to Hexadecimal
\li Converts an integer literal to hexadecimal representation
\row
\li Convert to Octal
\li Converts an integer literal to octal representation
\endtable
\section1 Operator
\table
\header
\li Quick Fix
\li Description
\li Operator
\row \row
\li Rewrite Condition Using || \li Rewrite Condition Using ||
\li Rewrites the expression according to De Morgan's laws. For \li Rewrites the expression according to De Morgan's laws. For
@@ -200,21 +555,6 @@
\endlist \endlist
\li \c {<=}, \c {<}, \c {>}, \c {>=}, \c {==} or \c {!=} \li \c {<=}, \c {<}, \c {>}, \c {>=}, \c {==} or \c {!=}
\row
\li Split Declaration
\li Splits a simple declaration into several declarations. For
example, rewrites:
\code
int *a, b;
\endcode
as
\code
int *a;
int b;
\endcode
\li Type name or variable name
\row \row
\li Split if Statement \li Split if Statement
\li Splits an if statement into several statements. For example, \li Splits an if statement into several statements. For example,
@@ -265,18 +605,14 @@
\endcode \endcode
\li \c {<=}, \c {<}, \c {>}, \c {>=}, \c {==}, \c {!=}, \c {&&} \li \c {<=}, \c {<}, \c {>}, \c {>=}, \c {==}, \c {!=}, \c {&&}
or \c {||} or \c {||}
\row \endtable
\li Convert to Decimal
\li Converts an integer literal to decimal representation \section1 String Literal
\li Numeric literal
\row \table
\li Convert to Hexadecimal \header
\li Converts an integer literal to hexadecimal representation \li Quick Fix
\li Numeric literal \li Description
\row
\li Convert to Octal
\li Converts an integer literal to octal representation
\li Numeric literal
\row \row
\li Convert to Objective-C String Literal \li Convert to Objective-C String Literal
\li Converts a string literal to an Objective-C string literal if \li Converts a string literal to an Objective-C string literal if
@@ -294,7 +630,18 @@
\code \code
@"abcd" @"abcd"
\endcode \endcode
\li String literal \row
\li Enclose in QByteArrayLiteral()
\li Converts a string to a byte array. For example, rewrites
\code
"abcd"
\endcode
as
\code
QByteArrayLiteral("abcd")
\endcode
\row \row
\li Enclose in QLatin1Char() \li Enclose in QLatin1Char()
\li Sets the encoding for a character to Latin-1, unless the \li Sets the encoding for a character to Latin-1, unless the
@@ -311,7 +658,6 @@
\code \code
QLatin1Char('a') QLatin1Char('a')
\endcode \endcode
\li String literal
\row \row
\li Enclose in QLatin1String() \li Enclose in QLatin1String()
\li Sets the encoding for a string to Latin-1, unless the string is \li Sets the encoding for a string to Latin-1, unless the string is
@@ -326,22 +672,10 @@
\code \code
QLatin1String("abcd") QLatin1String("abcd")
\endcode \endcode
\li String literal
\row \row
\li Enclose in QByteArrayLiteral() \li Escape String Literal as UTF-8
\li Converts a string to a byte array. For example, rewrites \li Escapes non-ASCII characters in a string literal to hexadecimal
\code escape sequences. String Literals are handled as UTF-8.
"abcd"
\endcode
as
\code
QByteArrayLiteral("abcd")
\endcode
\li String literal
\row \row
\li Mark as Translatable \li Mark as Translatable
\li Marks a string translatable. For example, rewrites \c "abcd" \li Marks a string translatable. For example, rewrites \c "abcd"
@@ -353,104 +687,37 @@
QCoreApplication::translate("CONTEXT", "abcd") QCoreApplication::translate("CONTEXT", "abcd")
QT_TRANSLATE_NOOP("GLOBAL", "abcd") QT_TRANSLATE_NOOP("GLOBAL", "abcd")
\endcode \endcode
\li String literal
\row \row
\li Add Definition in ... \li Unescape String Literal as UTF-8
\li Inserts a definition stub for a function declaration either in \li Unescapes octal or hexadecimal escape sequences in a string
the header file (inside or outside the class) or in the literal. String Literals are handled as UTF-8.
implementation file. For free functions, inserts the definition \endtable
after the declaration of the function or in the implementation
file. Qualified names are minimized when possible, instead of
always being fully expanded.
For example, rewrites \section1 \c using directive
\code \table
Class Foo { \header
void bar(); \li Quick Fix
}; \li Description
\endcode
as (inside class)
\code
Class Foo {
void bar() {
}
};
\endcode
as (outside class)
\code
Class Foo {
void bar();
};
void Foo::bar()
{
}
\endcode
as (in implementation file)
\code
// Header file
Class Foo {
void bar();
};
// Implementation file
void Foo::bar()
{
}
\endcode
\li Function name
\row \row
\li Add \c Function Declaration \li Remove All Occurrences of \c {using namespace} in Global Scope
\li Inserts the member function declaration that matches the member and Adjust Type Names Accordingly
function definition into the class declaration. The function can \li Remove all occurrences of \c {using namespace} in the global
be \c {public}, \c {protected}, \c {private}, \c {public slot}, scope and adjust type names accordingly.
\c {protected slot}, or \c {private slot}.
\li Function name
\row \row
\li Add Class Member \li Remove \c {using namespace} and Adjust Type Names Accordingly
\li Adds a member declaration for the class member being \li Remove occurrences of \c {using namespace} in the local scope
initialized if it is not yet declared. If \QC cannot and adjust type names accordingly.
automatically detect the data type of the member, you \endtable
must add it.
\li Identifier
\row \section1 Miscellaneous
\li Create Implementations for Member Functions
\li Creates implementations for all member functions in one go. \table
In the \uicontrol {Member Function Implementations} dialog, \header
specify whether the member functions are generated \li Quick Fix
inline or outside the class. \li Description
\li Function name \li Activation
\row
\li Switch with Next/Previous Parameter
\li Moves a parameter down or up one position in a parameter list.
\li Parameter in the declaration or definition of a function
\row
\li Extract Function
\li Moves the selected code to a new function and replaces the block
of code with a call to the new function. Enter a name for the
function in the \uicontrol {Extract Function Refactoring}
dialog.
\li Block of code selected
\row
\li Extract Constant as Function Parameter
\li Replaces the selected literal and all its occurrences with the
function parameter \c{newParameter}. The parameter
\c{newParameter} will have the original literal as the default
value.
\li Block of code selected
\row \row
\li Add Local Declaration \li Add Local Declaration
\li Adds the type of an assignee, if the type of the right-hand \li Adds the type of an assignee, if the type of the right-hand
@@ -469,63 +736,59 @@
where Type is the return type of \c {foo()} where Type is the return type of \c {foo()}
\li Assignee \li Assignee
\row
\li Convert connect() to Qt 5 Style
\li Converts a Qt 4 QObject::connect() to Qt 5 style.
\li QObject::connect() (Qt 4 style)
\row
\li Convert Comment to C/C++ Style
\li Converts C-style comments into C++-style comments, and vice
versa. Tries to preserve \e pretty layout and takes Doxygen and
qdoc formatting into consideration, but you might need to clean
up the results.
\li Code comment
\row
\li Convert to Pointer
\li Converts the selected stack variable to a pointer. For example,
rewrites:
\code
QByteArray foo = "foo";
foo.append("bar");
\endcode
as
\code
QByteArray *foo = new QByteArray("foo");
foo->append("bar");
\endcode
This operation is limited to work only within function scope.
Also, the coding style for pointers and references is not
respected yet.
\li Stack Variable
\row \row
\li Convert to Camel Case \li Convert to Stack Variable
\li Converts a symbol name to camel case, where elements of the name \li Converts the selected pointer to a stack variable. For example,
are joined without delimiter characters and the initial rewrites:
character of each element is capitalized. For example, rewrites
\c an_example_symbol as \c anExampleSymbol and \code
\c AN_EXAMPLE_SYMBOL as \c AnExampleSymbol QByteArray *foo = new QByteArray("foo");
\li Identifier foo->append("bar");
\row \endcode
\li Complete Switch Statement
\li Adds all possible cases to a switch statement of the type as
\c enum
\li \c switch \code
\row QByteArray foo("foo");
\li Generate Missing Q_PROPERTY Members foo.append("bar");
\li Adds missing members to a \c Q_PROPERTY: \endcode
\list
\li \c read function This operation is limited to work only within function scope.
\li \c write function, if there is a WRITE Also, the coding style for pointers and references is not
\li \c {onChanged} signal, if there is a NOTIFY respected yet.
\li data member with the name \c {m_<propertyName>} \li Pointer Variable
\endlist
\li \c Q_PROPERTY
\row
\li Generate Q_PROPERTY and Missing Members
\li Generates a Q_PROPERTY and adds missing members to it, as
described above.
\li Class member
\row
\li Generate Constant Q_PROPERTY and Missing Members
\li Generates a constant Q_PROPERTY and adds missing members
to it, as described above.
\li Class member
\row
\li Generate Q_PROPERTY and Missing Members with Reset Function
\li Generates a Q_PROPERTY and adds missing members to it, as
described above, but with an additional \c reset function.
\li Class member
\row
\li Apply Changes
\li Keeps function declarations and definitions synchronized by
checking for the matching declaration or definition when you
edit a function signature and by applying the changes to the
matching code.
\li Function signature. When this fix is available, a light bulb
icon appears: \inlineimage icons/refactormarker.png
\row
\li Add #include for undeclared or forward declared identifier
\li Adds an \c {#include} directive to the current file to make the
definition of a symbol available.
\li Undeclared identifier
\row
\li Add Forward Declaration
\li Adds a forward declaration for an undeclared identifier
operation.
\li Undeclared identifier
\row \row
\li Reformat Pointers or References \li Reformat Pointers or References
\li Reformats declarations with pointers or references according \li Reformats declarations with pointers or references according
@@ -551,239 +814,24 @@
\li Declarations with pointers or references and selections \li Declarations with pointers or references and selections
that have such declarations that have such declarations
\row \row
\li Create Getter and Setter Member Functions \li Split Declaration
\li Creates either both getter and setter member functions for \li Splits a simple declaration into several declarations. For
member variables or only a getter or setter.
\li Member variable in class definition
\row
\li Generate Getter and Setter
\li Creates getter and setter member functions for a member
variable.
\li Member variable in class definition
\row
\li Generate Getter
\li Creates a getter member function for a member variable.
\li Member variable in class definition
\row
\li Generate Setter
\li Creates a setter member function for a member variable.
\li Member variable in class definition
\row
\li Generate Constructor
\li Creates a constructor for a class.
\li Class definition
\row
\li Move Function Definition
\li Moves a function definition to the implementation file, outside
the class or back to its declaration. For example, rewrites:
\code
class Foo
{
void bar()
{
// do stuff here
}
};
\endcode
as
\code
class Foo
{
void bar();
};
void Foo::bar() {
// do stuff here
}
\endcode
\li Function signature
\row
\li Move All Function Definitions
\li Moves all function definitions to the implementation file or
outside the class. For example, rewrites:
\code
class Foo
{
void bar()
{
// do stuff here
}
void baz()
{
// do stuff here
}
};
\endcode
as
\code
class Foo
{
void bar();
void baz();
};
void Foo::bar() {
// do stuff here
}
void Foo::baz() {
// do stuff here
}
\endcode
\li Class name
\row
\li Move Definition Here
\li Moves an existing function definition to its declaration.
\li Function declaration
\row
\li Assign to Local Variable
\li Adds a local variable which stores the return value of a
function call or a new expression. For example, rewrites:
\code
QString s;
s.toLatin1();
\endcode
as
\code
QString s;
QByteArray latin1 = s.toLatin1();
\endcode
and
\code
new Foo;
\endcode
as
\code
Foo * localFoo = new Foo;
\endcode
By default, \QC uses the \c auto variable type when creating the
variable. To label the variable with its actual type, select
\preferences > \uicontrol C++ >
\uicontrol {Quick Fixes}, and then deselect the
\uicontrol {Use type "auto" when creating new variables} check
box.
\li Function call or class name
\row
\li Insert Virtual Functions of Base Classes
\li Inserts declarations and the corresponding definitions inside or
outside the class or in an implementation file (if it exists).
For more information, see \l{Insert virtual functions}.
\li Class or base class name
\row
\li Optimize for-Loop
\li Rewrites post increment operators as pre increment operators and
post decrement operators as pre decrement operators. It also
moves other than string or numeric literals and id expressions
from the condition of a for loop to its initializer. For
example, rewrites: example, rewrites:
\code \code
for (int i = 0; i < 3 * 2; i++) int *a, b;
\endcode \endcode
as as
\code \code
for (int i = 0, total = 3 * 2; i < total; ++i) int *a;
int b;
\endcode \endcode
\li \c for \li Type name or variable name
\row \row
\li Escape String Literal as UTF-8 \li Switch with Next/Previous Parameter
\li Escapes non-ASCII characters in a string literal to hexadecimal \li Moves a parameter down or up one position in a parameter list.
escape sequences. String Literals are handled as UTF-8. \li Parameter in the declaration or definition of a function
\li String literal
\row
\li Unescape String Literal as UTF-8
\li Unescapes octal or hexadecimal escape sequences in a string
literal. String Literals are handled as UTF-8.
\li String literal
\row
\li Convert to Stack Variable
\li Converts the selected pointer to a stack variable. For example,
rewrites:
\code
QByteArray *foo = new QByteArray("foo");
foo->append("bar");
\endcode
as
\code
QByteArray foo("foo");
foo.append("bar");
\endcode
This operation is limited to work only within function scope.
Also, the coding style for pointers and references is not
respected yet.
\li Pointer Variable
\row
\li Convert to Pointer
\li Converts the selected stack variable to a pointer. For example,
rewrites:
\code
QByteArray foo = "foo";
foo.append("bar");
\endcode
as
\code
QByteArray *foo = new QByteArray("foo");
foo->append("bar");
\endcode
This operation is limited to work only within function scope.
Also, the coding style for pointers and references is not
respected yet.
\li Stack Variable
\row
\li Remove \c {using namespace} and Adjust Type Names Accordingly
\li Remove occurrences of \c {using namespace} in the local scope
and adjust type names accordingly.
\li \c using directive
\row
\li Remove All Occurrences of \c {using namespace} in Global Scope
and Adjust Type Names Accordingly
\li Remove all occurrences of \c {using namespace} in the global
scope and adjust type names accordingly.
\li \c using directive
\row
\li Convert connect() to Qt 5 Style
\li Converts a Qt 4 QObject::connect() to Qt 5 style.
\li QObject::connect() (Qt 4 style)
\row
\li Convert Comment to C/C++ Style
\li Converts C-style comments into C++-style comments, and vice
versa. Tries to preserve \e pretty layout and takes Doxygen and
qdoc formatting into consideration, but you might need to clean
up the results.
\li Code comment
\row
\li Move Function Documentation to Declaration/Definition
\li Moves the documentation comment for a function between its
declaration and definition.
\li Documentation comment for a function
\endtable \endtable
\sa {Apply quick fixes}, {Find symbols}, {Rename symbols}, \sa {Apply quick fixes}, {Find symbols}, {Rename symbols},

View File

@@ -54,6 +54,8 @@
\list \list
\li Interpret the \key Tab and \key Backspace key presses. \li Interpret the \key Tab and \key Backspace key presses.
\li Add macros that the indenter interprets as complete statements that
don't require a semicolon at the end.
\li Indent the contents of classes, functions, blocks, and namespaces. \li Indent the contents of classes, functions, blocks, and namespaces.
\li Indent braces in classes, namespaces, enums, functions, and blocks. \li Indent braces in classes, namespaces, enums, functions, and blocks.
\li Control switch statements and their contents. \li Control switch statements and their contents.

View File

@@ -38,7 +38,7 @@
By default, the refactored files are saved automatically. To turn off By default, the refactored files are saved automatically. To turn off
this feature, go to \preferences > \uicontrol Environment > this feature, go to \preferences > \uicontrol Environment >
\uicontrol System and select \uicontrol {Auto-save files after refactoring}. \uicontrol System and clear \uicontrol {Auto-save files after refactoring}.
\if defined(qtcreator) \if defined(qtcreator)
\section1 Create functions \section1 Create functions
@@ -94,6 +94,17 @@
{C++ Quick Fixes} {C++ Quick Fixes}
\endif \endif
\section1 Move classes to separate files
Apply the \uicontrol {Move Class to a Dedicated Set of Source Files} quick
fix to move a class to a separate set of header and implementation files.
\image qtcreator-move-class-to-separate-files.webp {Give names to header and implementation files}
Specify paths and file names for the header and implementation file.
To omit the implementation file, select \uicontrol {Header file only}.
\sa {Rename symbols}, {QML Quick Fixes} \sa {Rename symbols}, {QML Quick Fixes}
*/ */

View File

@@ -91,7 +91,7 @@
For more information about the project file settings, see For more information about the project file settings, see
\l{Declaring Other Libraries}{qmake Manual: Declaring Other Libraries}. \l{Declaring Other Libraries}{qmake Manual: Declaring Other Libraries}.
\sa {Adding an Internal Library to a qmake Project}{Tutorial: Adding an Internal Library to a qmake Project}, \sa {Using an Internal Library in a qmake Project}{Tutorial: Using an Internal Library in a qmake Project},
{Add subprojects to projects}, {Add libraries to CMake projects}, {Add subprojects to projects}, {Add libraries to CMake projects},
{Use project wizards}, {Creating Projects} {Use project wizards}, {Creating Projects}
*/ */
@@ -103,7 +103,7 @@
\ingroup creator-tutorials \ingroup creator-tutorials
\title Adding an Internal Library to a qmake Project \title Using an Internal Library in a qmake Project
\brief How to create your own library and link your application against it \brief How to create your own library and link your application against it
when using qmake as the build system. when using qmake as the build system.

View File

@@ -0,0 +1,275 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/*!
\page lua-extensions.html
\title Extending \QC with Lua
\QC can be extended with Lua scripts. The included Lua engine is based on Lua 5.4.6.
\section1 Writing Lua Extensions
To create a new Lua extension, choose \uicontrol {File} > \uicontrol {New Project} >
\uicontrol {Library} > \uicontrol {\QC Lua Plugin}.
To test your new extension, start your project. Your \uicontrol {Application Output}
should show \e {Hello from Lua!}.
\section1 Lua Extension Specification
A Lua extension consists of a Lua script with the same name as the folder it is in.
This is necessary for the extension to be loaded.
This script defines the specification of the extension, such as its display name, vendor, copyright.
\code
--- MyExtension.lua
return {
Name = "MyExtension",
Version = "1.0.0",
CompatVersion = "1.0.0",
Vendor = "My Company",
Category = "Tests",
Description = "Describe what your extension does in a sentence.",
LongDescription = [[
Tell users more about your extension.
]],
Dependencies = {
{ Name = "Core", Version = "13.0.82", Required = true },
{ Name = "Lua", Version = "13.0.82", Required = true }
},
setup = function() print("Hello from Lua!") end,
printToOutputPane = true,
} --[[@as QtcPlugin]]
\endcode
\section1 The Setup Function
The setup function is called when the extension is loaded. This is where you can set up the
functionality of your extension. Since the specification file is parsed with very limited
permissions, you need to require a module where you implement the actual functionality.
\code
--- MyExtension.lua
return {
Name = "MyExtension",
Version = "1.0.0",
...,
--- This is the setup function that is called when the extension is loaded.
--- It requires the 'init' module and calls the setup function from the returned table.
setup = function() require 'init'.setup() end,
}
\endcode
\code
--- init.lua
function setup()
print("Hello from Lua!")
end
-- Returns a table with a single field 'setup' that points to the setup function.
return {
setup = setup
}
\endcode
\section1 Asynchronous Operations
Some of the built-in operations work asynchronously. To handle this, use the Async module.
\code
local a = require 'async'
local u = require 'Utils'
a.sync(function()
print("Lets wait for 5 seconds ...")
a.wait(u.waitms(5000))
print("... done!")
end)
\endcode
\section1 Interactive Help
When you open a .lua file in the editor the first time, you are asked to download the Lua
Language Server. This is extremely useful as it gives you context sensitive help and
auto-completion.
\section1 \QC API
The \QC API is available to Lua extensions via a number of modules that you can import
using the \c {require} function. C++ extensions may provide additional modules. One example of that
is the LanguageServer Extension that provides a module for creating Language Server clients.
You can find the API documentation files for the Lua modules in your \QC installation.
On \macos you can find them in \c{Qt Creator.app/Contents/Resources/lua/meta}.
\annotatedlist lua-modules
\section1 Extending the Lua API with C++
To add functionality to the Lua Interface, you need to register a new module with the Lua Engine.
\code
#include <lua/luaengine.h>
class MyCppExtension final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MyCppExtension.json")
public:
MyCppExtension() {}
private:
void initialize() final {
// The registered function will be called when the Lua module 'MyCppExtension' is required.
// The returned table will be returned from the require call in Lua.
::Lua::LuaEngine::registerProvider("MyCppExtension", [](sol::state_view lua) -> sol::object {
sol::table result = lua.create_table();
result["myFunction"] = [](int a, int b) { return a + b; };
return result;
});
}
};
\endcode
You can then access \c{MyCppExtension.myFunction} from your Lua scripts like this:
\code
local MyCppExtension = require 'MyCppExtension'
--- MyCppExtension is now a table with a single field 'myFunction', as it is returned from the
--- C++ function registered via 'LuaEngine::registerProvider(...)'.
print(MyCppExtension.myFunction(1, 2))
\endcode
For more information on how to register C++ functionality, see
\l {https://sol2.readthedocs.io/en/latest/index.html} {sol2}.
\section1 Examples
\section2 Language Server
The \QC LuaLanguageClient Plugin provides support for registering your own Language Server
clients. You can find an example of how to use this in the \QC Extension "Lua Language Server"
and "Rust Language Server".
*/
/*!
\page lua-extension-meta-core
\ingroup lua-modules
\title Core.lua
\brief Access and interact with the core functionality of \QC.
\quotefile ../../../src/plugins/lua/meta/core.lua
*/
/*!
\page lua-extension-meta-action
\ingroup lua-modules
\title action.lua
\brief Create user interface actions in \QC.
\quotefile ../../../src/plugins/lua/meta/action.lua
*/
/*!
\page lua-extension-meta-async
\ingroup lua-modules
\title async.lua
\brief Handle asynchronouse operations with the async/await Lua API.
\quotefile ../../../src/plugins/lua/meta/async.lua
*/
/*!
\page lua-extension-meta-fetch
\ingroup lua-modules
\title fetch.lua
\brief Fetch data from the internet.
\quotefile ../../../src/plugins/lua/meta/fetch.lua
*/
/*!
\page lua-extension-meta-gui
\ingroup lua-modules
\title gui.lua
\brief Create user interfaces.
\quotefile ../../../src/plugins/lua/meta/gui.lua
*/
/*!
\page lua-extension-meta-lsp
\ingroup lua-modules
\title lsp.lua
\brief Register Language Server clients.
\quotefile ../../../src/plugins/lua/meta/lsp.lua
*/
/*!
\page lua-extension-meta-messagemanager
\ingroup lua-modules
\title messagemanager.lua
\brief Display messages to the user.
\quotefile ../../../src/plugins/lua/meta/messagemanager.lua
*/
/*!
\page lua-extension-meta-process
\ingroup lua-modules
\title process.lua
\brief Run external processes.
\quotefile ../../../src/plugins/lua/meta/process.lua
*/
/*!
\page lua-extension-meta-qt
\ingroup lua-modules
\title qt.lua
\brief Access Qt functionality.
\quotefile ../../../src/plugins/lua/meta/qt.lua
*/
/*!
\page lua-extension-meta-qtc
\ingroup lua-modules
\title qtc.lua
\brief Access and extend \QC.
\quotefile ../../../src/plugins/lua/meta/qtc.lua
*/
/*!
\page lua-extension-meta-settings
\ingroup lua-modules
\title settings.lua
\brief Read and write settings.
\quotefile ../../../src/plugins/lua/meta/settings.lua
*/
/*!
\page lua-extension-meta-simpletypes
\ingroup lua-modules
\title simpletypes.lua
\brief Access simple types.
\quotefile ../../../src/plugins/lua/meta/simpletypes.lua
*/
/*!
\page lua-extension-meta-utils
\ingroup lua-modules
\title utils.lua
\brief Common utility functions and classes.
\quotefile ../../../src/plugins/lua/meta/utils.lua
*/

View File

@@ -216,6 +216,15 @@
\endomit \endomit
\endlist \endlist
\section1 Lua Extensions
If you have more specific needs that are not covered by the above methods but don't need
a full-blown plugin, you can extend \QC with Lua Extensions.
\list
\li \l{Extending \QC with Lua}
\endlist
\section1 All Topics \section1 All Topics
\list \list

View File

@@ -7,6 +7,6 @@ Product {
prefix: sourceDirectory + '/' + product.name + '/' prefix: sourceDirectory + '/' + product.name + '/'
files: luafiles files: luafiles
qbs.install: true qbs.install: true
qbs.installDir: qtc.ide_plugin_path + '/lua-plugins/' + product.name qbs.installDir: qtc.ide_plugin_path + '/' + product.name
} }
} }

View File

@@ -331,8 +331,7 @@ class Dumper(DumperBase):
self.qtNamespace = lambda: namespace self.qtNamespace = lambda: namespace
return namespace return namespace
def qtVersion(self): def extractQtVersion(self):
qtVersion = None
try: try:
qtVersion = self.parseAndEvaluate( qtVersion = self.parseAndEvaluate(
'((void**)&%s)[2]' % self.qtHookDataSymbolName()).integer() '((void**)&%s)[2]' % self.qtHookDataSymbolName()).integer()
@@ -344,10 +343,7 @@ class Dumper(DumperBase):
(major, minor, patch) = version.decode('latin1').split('.') (major, minor, patch) = version.decode('latin1').split('.')
qtVersion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch) qtVersion = 0x10000 * int(major) + 0x100 * int(minor) + int(patch)
except: except:
pass return None
if qtVersion is None:
qtVersion = self.fallbackQtVersion
self.qtVersion = lambda: qtVersion
return qtVersion return qtVersion
def putVtableItem(self, address): def putVtableItem(self, address):

View File

@@ -559,18 +559,17 @@ QString PluginSpec::errorString() const
} }
/*! /*!
Returns whether this plugin can be used to fill in a dependency of the given Returns whether the plugin \a spec can be used to fill the \a dependency of this plugin.
\a pluginName and \a pluginVersion.
\sa PluginSpec::dependencies() \sa PluginSpec::dependencies()
*/ */
bool PluginSpec::provides(const QString &pluginName, const QString &pluginVersion) const bool PluginSpec::provides(PluginSpec *spec, const PluginDependency &dependency) const
{ {
if (QString::compare(pluginName, name(), Qt::CaseInsensitive) != 0) if (QString::compare(dependency.name, spec->name(), Qt::CaseInsensitive) != 0)
return false; return false;
return (versionCompare(version(), pluginVersion) >= 0) return (versionCompare(spec->version(), dependency.version) >= 0)
&& (versionCompare(compatVersion(), pluginVersion) <= 0); && (versionCompare(spec->compatVersion(), dependency.version) <= 0);
} }
/*! /*!
@@ -1075,8 +1074,8 @@ bool PluginSpec::resolveDependencies(const PluginSpecs &specs)
QHash<PluginDependency, PluginSpec *> resolvedDependencies; QHash<PluginDependency, PluginSpec *> resolvedDependencies;
for (const PluginDependency &dependency : d->dependencies) { for (const PluginDependency &dependency : d->dependencies) {
PluginSpec *const found = findOrDefault(specs, [&dependency](PluginSpec *spec) { PluginSpec *const found = findOrDefault(specs, [this, &dependency](PluginSpec *spec) {
return spec->provides(dependency.name, dependency.version); return provides(spec, dependency);
}); });
if (!found) { if (!found) {
if (dependency.type == PluginDependency::Required) { if (dependency.type == PluginDependency::Required) {

View File

@@ -36,13 +36,14 @@ class PluginView;
struct EXTENSIONSYSTEM_EXPORT PluginDependency struct EXTENSIONSYSTEM_EXPORT PluginDependency
{ {
enum Type { enum Type { Required, Optional, Test };
Required,
Optional,
Test
};
PluginDependency() : type(Required) {} PluginDependency() : type(Required) {}
PluginDependency(const QString &name, const QString &version, Type type = Required)
: name(name)
, version(version)
, type(type)
{}
QString name; QString name;
QString version; QString version;
@@ -130,7 +131,7 @@ public:
virtual void addArgument(const QString &argument); virtual void addArgument(const QString &argument);
virtual QHash<PluginDependency, PluginSpec *> dependencySpecs() const; virtual QHash<PluginDependency, PluginSpec *> dependencySpecs() const;
virtual bool provides(const QString &pluginName, const QString &pluginVersion) const; virtual bool provides(PluginSpec *spec, const PluginDependency &dependency) const;
virtual bool requiresAny(const QSet<PluginSpec *> &plugins) const; virtual bool requiresAny(const QSet<PluginSpec *> &plugins) const;
virtual PluginSpecs enableDependenciesIndirectly(bool enableTestDependencies); virtual PluginSpecs enableDependenciesIndirectly(bool enableTestDependencies);
virtual bool resolveDependencies(const PluginSpecs &pluginSpecs); virtual bool resolveDependencies(const PluginSpecs &pluginSpecs);

View File

@@ -153,7 +153,7 @@ StaticAnalysisMessages::StaticAnalysisMessages()
Tr::tr("Invalid property type \"%1\"."), 1); Tr::tr("Invalid property type \"%1\"."), 1);
newMsg(WarnEqualityTypeCoercion, Error, newMsg(WarnEqualityTypeCoercion, Error,
Tr::tr("== and != perform type coercion, use === or !== to avoid it.")); Tr::tr("== and != perform type coercion, use === or !== to avoid it."));
newMsg(WarnExpectedNewWithUppercaseFunction, Error, newMsg(WarnExpectedNewWithUppercaseFunction, Warning,
Tr::tr("Calls of functions that start with an uppercase letter should use 'new'.")); Tr::tr("Calls of functions that start with an uppercase letter should use 'new'."));
newMsg(WarnNewWithLowercaseFunction, Error, newMsg(WarnNewWithLowercaseFunction, Error,
Tr::tr("Use 'new' only with functions that start with an uppercase letter.")); Tr::tr("Use 'new' only with functions that start with an uppercase letter."));

View File

@@ -1291,6 +1291,12 @@ const void *Loop::valuePtr() const
using StoragePtr = void *; using StoragePtr = void *;
static QString s_activeStorageWarning =
"The referenced storage is not reachable in the running tree. "
"A nullptr will be returned which might lead to a crash in the calling code. "
"It is possible that no storage was added to the tree, "
"or the storage is not reachable from where it is referenced.";
class StorageThreadData class StorageThreadData
{ {
Q_DISABLE_COPY_MOVE(StorageThreadData) Q_DISABLE_COPY_MOVE(StorageThreadData)
@@ -1299,7 +1305,7 @@ public:
StorageThreadData() = default; StorageThreadData() = default;
void pushStorage(StoragePtr storagePtr) void pushStorage(StoragePtr storagePtr)
{ {
m_activeStorageStack.push_back(storagePtr); m_activeStorageStack.push_back({storagePtr, activeTaskTree()});
} }
void popStorage() void popStorage()
{ {
@@ -1308,16 +1314,16 @@ public:
} }
StoragePtr activeStorage() const StoragePtr activeStorage() const
{ {
QT_ASSERT(m_activeStorageStack.size(), qWarning( QT_ASSERT(m_activeStorageStack.size(),
"The referenced storage is not reachable in the running tree. " qWarning().noquote() << s_activeStorageWarning; return nullptr);
"A nullptr will be returned which might lead to a crash in the calling code. " const QPair<StoragePtr, TaskTree *> &top = m_activeStorageStack.last();
"It is possible that no storage was added to the tree, " QT_ASSERT(top.second == activeTaskTree(),
"or the storage is not reachable from where it is referenced."); return nullptr); qWarning().noquote() << s_activeStorageWarning; return nullptr);
return m_activeStorageStack.last(); return top.first;
} }
private: private:
QList<StoragePtr> m_activeStorageStack; QList<QPair<StoragePtr, TaskTree *>> m_activeStorageStack;
}; };
class StorageData class StorageData

View File

@@ -210,11 +210,10 @@ QIcon Icon::sideBarIcon(const Icon &classic, const Icon &flat)
return result; return result;
} }
QIcon Icon::modeIcon(const Icon &classic, const Icon &flat, const Icon &flatActive) QIcon Icon::modeIcon(const Icon &classic, const Icon &flat,
[[__maybe_unused__]] const Icon &flatActive)
{ {
QIcon result = sideBarIcon(classic, flat); QIcon result = sideBarIcon(classic, flat);
if (creatorTheme()->flag(Theme::FlatSideBarIcons))
result.addPixmap(flatActive.pixmap(), QIcon::Active);
return result; return result;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 171 B

View File

@@ -49,7 +49,8 @@ void StartProcessPacket::doSerialize(QDataStream &stream) const
<< unixTerminalDisabled << unixTerminalDisabled
<< useCtrlCStub << useCtrlCStub
<< reaperTimeout << reaperTimeout
<< createConsoleOnWindows; << createConsoleOnWindows
<< forceDefaultErrorMode;
} }
void StartProcessPacket::doDeserialize(QDataStream &stream) void StartProcessPacket::doDeserialize(QDataStream &stream)
@@ -70,7 +71,8 @@ void StartProcessPacket::doDeserialize(QDataStream &stream)
>> unixTerminalDisabled >> unixTerminalDisabled
>> useCtrlCStub >> useCtrlCStub
>> reaperTimeout >> reaperTimeout
>> createConsoleOnWindows; >> createConsoleOnWindows
>> forceDefaultErrorMode;
processMode = Utils::ProcessMode(processModeInt); processMode = Utils::ProcessMode(processModeInt);
processChannelMode = QProcess::ProcessChannelMode(processChannelModeInt); processChannelMode = QProcess::ProcessChannelMode(processChannelModeInt);
} }

View File

@@ -99,6 +99,7 @@ public:
bool useCtrlCStub = false; bool useCtrlCStub = false;
int reaperTimeout = 500; int reaperTimeout = 500;
bool createConsoleOnWindows = false; bool createConsoleOnWindows = false;
bool forceDefaultErrorMode = false;
private: private:
void doSerialize(QDataStream &stream) const override; void doSerialize(QDataStream &stream) const override;

View File

@@ -260,6 +260,7 @@ void CallerHandle::start(const QString &program, const QStringList &arguments)
p.useCtrlCStub = m_setup->m_useCtrlCStub; p.useCtrlCStub = m_setup->m_useCtrlCStub;
p.reaperTimeout = m_setup->m_reaperTimeout.count(); p.reaperTimeout = m_setup->m_reaperTimeout.count();
p.createConsoleOnWindows = m_setup->m_createConsoleOnWindows; p.createConsoleOnWindows = m_setup->m_createConsoleOnWindows;
p.forceDefaultErrorMode = m_setup->m_forceDefaultErrorMode;
sendPacket(p); sendPacket(p);
} }

View File

@@ -55,12 +55,13 @@ void ProcessStartHandler::setNativeArguments(const QString &arguments)
#endif // Q_OS_WIN #endif // Q_OS_WIN
} }
void ProcessStartHandler::setWindowsSpecificStartupFlags(bool belowNormalPriority, void ProcessStartHandler::setWindowsSpecificStartupFlags(
bool createConsoleWindow) bool belowNormalPriority, bool createConsoleWindow, bool forceDefaultErrorMode)
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
m_process->setCreateProcessArgumentsModifier( m_process->setCreateProcessArgumentsModifier(
[belowNormalPriority, createConsoleWindow](QProcess::CreateProcessArguments *args) { [belowNormalPriority, createConsoleWindow, forceDefaultErrorMode](
QProcess::CreateProcessArguments *args) {
if (createConsoleWindow) { if (createConsoleWindow) {
args->flags |= CREATE_NEW_CONSOLE; args->flags |= CREATE_NEW_CONSOLE;
args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES; args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES;
@@ -69,11 +70,13 @@ void ProcessStartHandler::setWindowsSpecificStartupFlags(bool belowNormalPriorit
if (belowNormalPriority) if (belowNormalPriority)
args->flags |= BELOW_NORMAL_PRIORITY_CLASS; args->flags |= BELOW_NORMAL_PRIORITY_CLASS;
if (forceDefaultErrorMode)
args->flags |= CREATE_DEFAULT_ERROR_MODE; args->flags |= CREATE_DEFAULT_ERROR_MODE;
}); });
#else // Q_OS_WIN #else // Q_OS_WIN
Q_UNUSED(belowNormalPriority) Q_UNUSED(belowNormalPriority)
Q_UNUSED(createConsoleWindow) Q_UNUSED(createConsoleWindow)
Q_UNUSED(forceDefaultErrorMode)
#endif #endif
} }

View File

@@ -20,7 +20,8 @@ public:
void handleProcessStart(); void handleProcessStart();
void handleProcessStarted(); void handleProcessStarted();
void setNativeArguments(const QString &arguments); void setNativeArguments(const QString &arguments);
void setWindowsSpecificStartupFlags(bool belowNormalPriority, bool createConsoleWindow); void setWindowsSpecificStartupFlags(
bool belowNormalPriority, bool createConsoleWindow, bool forceDefaultErrorMode);
private: private:
ProcessMode m_processMode = ProcessMode::Reader; ProcessMode m_processMode = ProcessMode::Reader;

View File

@@ -94,6 +94,7 @@ public:
bool m_useCtrlCStub = false; bool m_useCtrlCStub = false;
bool m_belowNormalPriority = false; // internal, dependent on other fields and specific code path bool m_belowNormalPriority = false; // internal, dependent on other fields and specific code path
bool m_createConsoleOnWindows = false; bool m_createConsoleOnWindows = false;
bool m_forceDefaultErrorMode = false;
}; };
class QTCREATOR_UTILS_EXPORT ProcessResultData class QTCREATOR_UTILS_EXPORT ProcessResultData

View File

@@ -511,7 +511,8 @@ private:
handler->setWriteData(m_setup.m_writeData); handler->setWriteData(m_setup.m_writeData);
handler->setNativeArguments(m_setup.m_nativeArguments); handler->setNativeArguments(m_setup.m_nativeArguments);
handler->setWindowsSpecificStartupFlags(m_setup.m_belowNormalPriority, handler->setWindowsSpecificStartupFlags(m_setup.m_belowNormalPriority,
m_setup.m_createConsoleOnWindows); m_setup.m_createConsoleOnWindows,
m_setup.m_forceDefaultErrorMode);
const QProcessEnvironment penv = m_setup.m_environment.toProcessEnvironment(); const QProcessEnvironment penv = m_setup.m_environment.toProcessEnvironment();
if (!penv.isEmpty()) if (!penv.isEmpty())
@@ -1383,6 +1384,16 @@ bool Process::createConsoleOnWindows() const
return d->m_setup.m_createConsoleOnWindows; return d->m_setup.m_createConsoleOnWindows;
} }
void Process::setForceDefaultErrorModeOnWindows(bool force)
{
d->m_setup.m_forceDefaultErrorMode = force;
}
bool Process::forceDefaultErrorModeOnWindows() const
{
return d->m_setup.m_forceDefaultErrorMode;
}
void Process::setExtraData(const QString &key, const QVariant &value) void Process::setExtraData(const QString &key, const QVariant &value)
{ {
d->m_setup.m_extraData.insert(key, value); d->m_setup.m_extraData.insert(key, value);

View File

@@ -187,6 +187,9 @@ public:
void setCreateConsoleOnWindows(bool create); void setCreateConsoleOnWindows(bool create);
bool createConsoleOnWindows() const; bool createConsoleOnWindows() const;
void setForceDefaultErrorModeOnWindows(bool force);
bool forceDefaultErrorModeOnWindows() const;
signals: signals:
void starting(); // On NotRunning -> Starting state transition void starting(); // On NotRunning -> Starting state transition
void started(); // On Starting -> Running state transition void started(); // On Starting -> Running state transition

View File

@@ -16,8 +16,19 @@
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h>
#include <psapi.h> #include <psapi.h>
#include <windows.h>
#endif
#ifdef Q_OS_MACOS
#include <sys/types.h>
#include <sys/proc_info.h>
#include <sys/sysctl.h>
#include <chrono>
#include <unistd.h>
#include <libproc.h>
#include <mach/mach_time.h>
#endif #endif
using namespace Utils; using namespace Utils;
@@ -258,9 +269,63 @@ public:
: IDataProvider(pid, parent) : IDataProvider(pid, parent)
{} {}
double getMemoryConsumption() { return 0; } double getCpuConsumption()
{
proc_taskallinfo taskAllInfo = {};
double getCpuConsumption() { return 0; } const int result
= proc_pidinfo(m_pid, PROC_PIDTASKALLINFO, 0, &taskAllInfo, sizeof(taskAllInfo));
if (result == -1) {
return 0;
}
mach_timebase_info_data_t sTimebase;
mach_timebase_info(&sTimebase);
double timebase_to_ns = (double) sTimebase.numer / (double) sTimebase.denom;
const double currentTotalCpuTime = ((double) taskAllInfo.ptinfo.pti_total_user
+ (double) taskAllInfo.ptinfo.pti_total_system)
* timebase_to_ns / 1e9;
const double cpuUsageDelta = currentTotalCpuTime - m_prevCpuUsage;
const auto elapsedTime = std::chrono::steady_clock::now() - m_prevTime;
const double elapsedTimeSeconds
= std::chrono::duration_cast<std::chrono::milliseconds>(elapsedTime).count() / 1000.0;
m_prevCpuUsage = currentTotalCpuTime;
m_prevTime = std::chrono::steady_clock::now();
return (cpuUsageDelta / elapsedTimeSeconds) * 100.0;
}
double getTotalPhysicalMemory()
{
int mib[2];
size_t length;
long long physicalMemory;
mib[0] = CTL_HW;
mib[1] = HW_MEMSIZE;
length = sizeof(physicalMemory);
sysctl(mib, 2, &physicalMemory, &length, NULL, 0);
return physicalMemory;
}
double getMemoryConsumption()
{
proc_taskinfo taskInfo;
int result = proc_pidinfo(m_pid, PROC_PIDTASKINFO, 0, &taskInfo, sizeof(taskInfo));
if (result == -1)
return 0;
return (taskInfo.pti_resident_size / getTotalPhysicalMemory()) * 100.0;
}
private:
std::chrono::steady_clock::time_point m_prevTime = std::chrono::steady_clock::now();
double m_prevCpuUsage = 0;
}; };
#endif #endif

View File

@@ -328,12 +328,11 @@ Toolchain::MacroInspectionRunner IarToolchain::createMacroInspectionRunner() con
return [env, compiler, extraArgs, macrosCache, languageId] return [env, compiler, extraArgs, macrosCache, languageId]
(const QStringList &flags) { (const QStringList &flags) {
Q_UNUSED(flags) Macros macros = dumpPredefinedMacros(compiler, extraArgs + flags, languageId, env);
Macros macros = dumpPredefinedMacros(compiler, extraArgs, languageId, env);
macros.append({"__intrinsic", "", MacroType::Define}); macros.append({"__intrinsic", "", MacroType::Define});
macros.append({"__nounwind", "", MacroType::Define}); macros.append({"__nounwind", "", MacroType::Define});
macros.append({"__noreturn", "", MacroType::Define}); macros.append({"__noreturn", "", MacroType::Define});
macros.append({"__no_init", "", MacroType::Define});
macros.append({"__packed", "", MacroType::Define}); macros.append({"__packed", "", MacroType::Define});
macros.append({"__spec_string", "", MacroType::Define}); macros.append({"__spec_string", "", MacroType::Define});
macros.append({"__constrange(__a,__b)", "", MacroType::Define}); macros.append({"__constrange(__a,__b)", "", MacroType::Define});

View File

@@ -145,7 +145,8 @@ const char G_HELP[] = "QtCreator.Group.Help";
// File menu groups // File menu groups
const char G_FILE_NEW[] = "QtCreator.Group.File.New"; const char G_FILE_NEW[] = "QtCreator.Group.File.New";
const char G_FILE_OPEN[] = "QtCreator.Group.File.Open"; const char G_FILE_OPEN[] = "QtCreator.Group.File.Open";
const char G_FILE_SESSION[] = "QtCreator.Group.File.Recent"; const char G_FILE_RECENT[] = "QtCreator.Group.File.Recent";
const char G_FILE_SESSION[] = "QtCreator.Group.File.Session";
const char G_FILE_PROJECT[] = "QtCreator.Group.File.Project"; const char G_FILE_PROJECT[] = "QtCreator.Group.File.Project";
const char G_FILE_SAVE[] = "QtCreator.Group.File.Save"; const char G_FILE_SAVE[] = "QtCreator.Group.File.Save";
const char G_FILE_EXPORT[] = "QtCreator.Group.File.Export"; const char G_FILE_EXPORT[] = "QtCreator.Group.File.Export";

View File

@@ -790,7 +790,7 @@ bool SettingsDialog::execDialog()
ICore::settings()->setValueWithDefault(kPreferenceDialogSize, size(), initialSize); ICore::settings()->setValueWithDefault(kPreferenceDialogSize, size(), initialSize);
// make sure that the current "single" instance is deleted // make sure that the current "single" instance is deleted
// we can't delete right away, since we still access the m_applied member // we can't delete right away, since we still access the m_applied member
deleteLater(); QMetaObject::invokeMethod(this, [this] { deleteLater(); }, Qt::QueuedConnection);
}); });
} }

View File

@@ -1629,6 +1629,7 @@ void ICorePrivate::registerDefaultContainers()
filemenu->menu()->setTitle(Tr::tr("&File")); filemenu->menu()->setTitle(Tr::tr("&File"));
filemenu->appendGroup(Constants::G_FILE_NEW); filemenu->appendGroup(Constants::G_FILE_NEW);
filemenu->appendGroup(Constants::G_FILE_OPEN); filemenu->appendGroup(Constants::G_FILE_OPEN);
filemenu->appendGroup(Constants::G_FILE_RECENT);
filemenu->appendGroup(Constants::G_FILE_SESSION); filemenu->appendGroup(Constants::G_FILE_SESSION);
filemenu->appendGroup(Constants::G_FILE_PROJECT); filemenu->appendGroup(Constants::G_FILE_PROJECT);
filemenu->appendGroup(Constants::G_FILE_SAVE); filemenu->appendGroup(Constants::G_FILE_SAVE);
@@ -1785,7 +1786,7 @@ void ICorePrivate::registerDefaultActions()
// File->Recent Files Menu // File->Recent Files Menu
ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES); ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES);
mfile->addMenu(ac, Constants::G_FILE_OPEN); mfile->addMenu(ac, Constants::G_FILE_RECENT);
ac->menu()->setTitle(Tr::tr("Recent &Files")); ac->menu()->setTitle(Tr::tr("Recent &Files"));
ac->setOnAllDisabledBehavior(ActionContainer::Show); ac->setOnAllDisabledBehavior(ActionContainer::Show);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 149 B

View File

@@ -162,7 +162,7 @@ void checkContents(QPromise<ArchiveIssue> &promise, const FilePath &tempDir)
[coreplugin](const PluginDependency &d) { return d.name == coreplugin->name(); }); [coreplugin](const PluginDependency &d) { return d.name == coreplugin->name(); });
if (found == dependencies.constEnd()) if (found == dependencies.constEnd())
return; return;
if (coreplugin->provides(found->name, found->version)) if ((*spec)->provides(coreplugin, *found))
return; return;
promise.addResult( promise.addResult(
ArchiveIssue{Tr::tr("Plugin requires an incompatible version of %1 (%2).") ArchiveIssue{Tr::tr("Plugin requires an incompatible version of %1 (%2).")

View File

@@ -744,6 +744,8 @@ void setupCppFileSettings(ExtensionSystem::IPlugin &plugin)
#ifdef WITH_TESTS #ifdef WITH_TESTS
plugin.addTestCreator([] { return new CppFileSettingsTest; }); plugin.addTestCreator([] { return new CppFileSettingsTest; });
#else
Q_UNUSED(plugin)
#endif #endif
} }

View File

@@ -1,5 +1,5 @@
#ifndef PROJECT_INTERNAL_THECLASS_H #ifndef THECLASS_H
#define PROJECT_INTERNAL_THECLASS_H #define THECLASS_H
namespace Project { namespace Project {
namespace Internal { namespace Internal {
@@ -26,4 +26,4 @@ template<typename T> T TheClass::defaultValue() const { return T(); }
} // namespace Internal } // namespace Internal
} // namespace Project } // namespace Project
#endif // PROJECT_INTERNAL_THECLASS_H #endif // THECLASS_H

View File

@@ -33,6 +33,7 @@ add_qtc_plugin(Debugger
dap/dapclient.cpp dap/dapclient.h dap/dapclient.cpp dap/dapclient.h
dap/dapengine.cpp dap/dapengine.h dap/dapengine.cpp dap/dapengine.h
dap/gdbdapengine.cpp dap/gdbdapengine.h dap/gdbdapengine.cpp dap/gdbdapengine.h
dap/lldbdapengine.cpp dap/lldbdapengine.h
dap/pydapengine.cpp dap/pydapengine.h dap/pydapengine.cpp dap/pydapengine.h
debugger.qrc debugger.qrc
debugger_global.h debugger_global.h

View File

@@ -6,6 +6,7 @@
#include "cmakedapengine.h" #include "cmakedapengine.h"
#include "dapclient.h" #include "dapclient.h"
#include "gdbdapengine.h" #include "gdbdapengine.h"
#include "lldbdapengine.h"
#include "pydapengine.h" #include "pydapengine.h"
#include <debugger/breakhandler.h> #include <debugger/breakhandler.h>
@@ -1058,6 +1059,8 @@ DebuggerEngine *createDapEngine(Utils::Id runMode)
return new CMakeDapEngine; return new CMakeDapEngine;
if (runMode == ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE) if (runMode == ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE)
return new GdbDapEngine; return new GdbDapEngine;
if (runMode == ProjectExplorer::Constants::DAP_LLDB_DEBUG_RUN_MODE)
return new LldbDapEngine;
if (runMode == ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE) if (runMode == ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE)
return new PyDapEngine; return new PyDapEngine;

View File

@@ -0,0 +1,176 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "lldbdapengine.h"
#include "dapclient.h"
#include <coreplugin/messagemanager.h>
#include <debugger/debuggermainwindow.h>
#include <utils/mimeconstants.h>
#include <utils/mimeutils.h>
#include <utils/temporarydirectory.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/projecttree.h>
#include <QDebug>
#include <QLocalSocket>
#include <QVersionNumber>
using namespace Core;
using namespace Utils;
namespace Debugger::Internal {
// TODO: Same class as in gdbdapengine.cpp. Refactor into one place.
class ProcessDataProvider : public IDataProvider
{
public:
ProcessDataProvider(const DebuggerRunParameters &rp,
const CommandLine &cmd,
QObject *parent = nullptr)
: IDataProvider(parent)
, m_runParameters(rp)
, m_cmd(cmd)
{
connect(&m_proc, &Process::started, this, &IDataProvider::started);
connect(&m_proc, &Process::done, this, &IDataProvider::done);
connect(&m_proc,
&Process::readyReadStandardOutput,
this,
&IDataProvider::readyReadStandardOutput);
connect(&m_proc,
&Process::readyReadStandardError,
this,
&IDataProvider::readyReadStandardError);
}
~ProcessDataProvider()
{
m_proc.kill();
m_proc.waitForFinished();
}
void start() override
{
m_proc.setProcessMode(ProcessMode::Writer);
if (m_runParameters.debugger.workingDirectory.isDir())
m_proc.setWorkingDirectory(m_runParameters.debugger.workingDirectory);
m_proc.setEnvironment(m_runParameters.debugger.environment);
m_proc.setCommand(m_cmd);
m_proc.start();
}
bool isRunning() const override { return m_proc.isRunning(); }
void writeRaw(const QByteArray &data) override
{
if (m_proc.state() == QProcess::Running)
m_proc.writeRaw(data);
}
void kill() override { m_proc.kill(); }
QByteArray readAllStandardOutput() override { return m_proc.readAllStandardOutput().toUtf8(); }
QString readAllStandardError() override { return m_proc.readAllStandardError(); }
int exitCode() const override { return m_proc.exitCode(); }
QString executable() const override { return m_proc.commandLine().executable().toUserOutput(); }
QProcess::ExitStatus exitStatus() const override { return m_proc.exitStatus(); }
QProcess::ProcessError error() const override { return m_proc.error(); }
Utils::ProcessResult result() const override { return m_proc.result(); }
QString exitMessage() const override { return m_proc.exitMessage(); };
private:
Utils::Process m_proc;
const DebuggerRunParameters m_runParameters;
const CommandLine m_cmd;
};
class LldbDapClient : public DapClient
{
public:
LldbDapClient(IDataProvider *provider, QObject *parent = nullptr)
: DapClient(provider, parent)
{}
private:
const QLoggingCategory &logCategory() override
{
static const QLoggingCategory logCategory = QLoggingCategory("qtc.dbg.dapengine.lldb",
QtWarningMsg);
return logCategory;
}
};
LldbDapEngine::LldbDapEngine()
: DapEngine()
{
setObjectName("LldbDapEngine");
setDebuggerName("LLDB");
setDebuggerType("DAP");
}
void LldbDapEngine::handleDapInitialize()
{
if (!isLocalAttachEngine()) {
DapEngine::handleDapInitialize();
return;
}
QTC_ASSERT(state() == EngineRunRequested, qCDebug(logCategory()) << state());
m_dapClient->postRequest("attach", QJsonObject{{"__restart", ""}});
qCDebug(logCategory()) << "handleDapAttach";
}
bool LldbDapEngine::isLocalAttachEngine() const
{
return runParameters().startMode == AttachToLocalProcess;
}
void LldbDapEngine::handleDapConfigurationDone()
{
if (!isLocalAttachEngine()) {
DapEngine::handleDapConfigurationDone();
return;
}
notifyEngineRunAndInferiorStopOk();
}
void LldbDapEngine::setupEngine()
{
QTC_ASSERT(state() == EngineSetupRequested, qCDebug(logCategory()) << state());
const DebuggerRunParameters &rp = runParameters();
CommandLine cmd{rp.debugger.command.executable()};
if (isLocalAttachEngine())
cmd.addArgs({"--debugger-pid", QString::number(rp.attachPID.pid())});
IDataProvider *dataProvider = new ProcessDataProvider(rp, cmd, this);
m_dapClient = new LldbDapClient(dataProvider, this);
connectDataGeneratorSignals();
m_dapClient->dataProvider()->start();
}
bool LldbDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
{
const auto mimeType = Utils::mimeTypeForFile(bp.fileName);
return mimeType.matchesName(Utils::Constants::C_HEADER_MIMETYPE)
|| mimeType.matchesName(Utils::Constants::C_SOURCE_MIMETYPE)
|| mimeType.matchesName(Utils::Constants::CPP_HEADER_MIMETYPE)
|| mimeType.matchesName(Utils::Constants::CPP_SOURCE_MIMETYPE)
|| bp.type == BreakpointByFunction;
}
const QLoggingCategory &LldbDapEngine::logCategory()
{
static const QLoggingCategory logCategory = QLoggingCategory("qtc.dbg.dapengine.lldb",
QtWarningMsg);
return logCategory;
}
} // namespace Debugger::Internal

View File

@@ -0,0 +1,26 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "dapengine.h"
namespace Debugger::Internal {
class LldbDapEngine : public DapEngine
{
public:
LldbDapEngine();
private:
void setupEngine() override;
void handleDapInitialize() override;
void handleDapConfigurationDone() override;
bool isLocalAttachEngine() const;
bool acceptsBreakpoint(const BreakpointParameters &bp) const override;
const QLoggingCategory &logCategory() override;
};
} // Debugger::Internal

View File

@@ -123,6 +123,7 @@ QtcPlugin {
"dapclient.cpp", "dapclient.h", "dapclient.cpp", "dapclient.h",
"dapengine.cpp", "dapengine.h", "dapengine.cpp", "dapengine.h",
"gdbdapengine.cpp", "gdbdapengine.h", "gdbdapengine.cpp", "gdbdapengine.h",
"lldbdapengine.cpp", "lldbdapengine.h",
"pydapengine.cpp", "pydapengine.h", "pydapengine.cpp", "pydapengine.h",
] ]
} }

View File

@@ -147,27 +147,16 @@ void DebuggerItem::reinitializeFromFile(QString *error, Utils::Environment *cust
Environment env = customEnv ? *customEnv : m_command.deviceEnvironment(); Environment env = customEnv ? *customEnv : m_command.deviceEnvironment();
// Prevent calling lldb on Windows because the lldb from the llvm package is linked against
// python but does not contain a python dll.
const bool isAndroidNdkLldb = DebuggerItem::addAndroidLldbPythonEnv(m_command, env);
const FilePath qtcreatorLldb = Core::ICore::lldbExecutable(CLANG_BINDIR);
if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb") && !isAndroidNdkLldb
&& qtcreatorLldb != m_command) {
QString errorMessage;
m_version = winGetDLLVersion(WinDLLFileVersion,
m_command.absoluteFilePath().path(),
&errorMessage);
m_engineType = LldbEngineType;
m_abis = Abi::abisOfBinary(m_command);
return;
}
// QNX gdb unconditionally checks whether the QNX_TARGET env variable is // QNX gdb unconditionally checks whether the QNX_TARGET env variable is
// set and bails otherwise, even when it is not used by the specific // set and bails otherwise, even when it is not used by the specific
// codepath triggered by the --version and --configuration arguments. The // codepath triggered by the --version and --configuration arguments. The
// hack below tricks it into giving us the information we want. // hack below tricks it into giving us the information we want.
env.set("QNX_TARGET", QString()); env.set("QNX_TARGET", QString());
// On Windows, we need to prevent the Windows Error Reporting dialog from
// popping up when a candidate is missing required DLLs.
WindowsCrashDialogBlocker blocker;
Process proc; Process proc;
proc.setEnvironment(env); proc.setEnvironment(env);
proc.setCommand({m_command, {version}}); proc.setCommand({m_command, {version}});

View File

@@ -1224,6 +1224,7 @@ void DebuggerPluginPrivate::createDapDebuggerPerspective(QWidget *globalLogWindo
ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE, ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE,
/*forceSkipDeploy=*/true}, /*forceSkipDeploy=*/true},
DapPerspective{Tr::tr("GDB Preset"), ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE}, DapPerspective{Tr::tr("GDB Preset"), ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE},
DapPerspective{Tr::tr("LLDB Preset"), ProjectExplorer::Constants::DAP_LLDB_DEBUG_RUN_MODE},
DapPerspective{Tr::tr("Python Preset"), ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE}, DapPerspective{Tr::tr("Python Preset"), ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE},
}; };

View File

@@ -1096,6 +1096,7 @@ DebuggerRunWorkerFactory::DebuggerRunWorkerFactory()
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::DAP_LLDB_DEBUG_RUN_MODE);
addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
addSupportedDeviceType("DockerDeviceType"); addSupportedDeviceType("DockerDeviceType");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 453 B

View File

@@ -1502,7 +1502,7 @@ void FakeVimPlugin::editorOpened(IEditor *editor)
handler->modeChanged.set([tew, this, editor](bool insertMode) { handler->modeChanged.set([tew, this, editor](bool insertMode) {
HandlerAndData &handlerAndData = m_editorToHandler[editor]; HandlerAndData &handlerAndData = m_editorToHandler[editor];
if (!handlerAndData.handler->inFakeVimMode()) if (!handlerAndData.handler || !handlerAndData.handler->inFakeVimMode())
return; return;
// We don't want to show suggestions unless we are in insert mode. // We don't want to show suggestions unless we are in insert mode.
@@ -1651,11 +1651,13 @@ void FakeVimPlugin::editorOpened(IEditor *editor)
keepOnlyWindow(); keepOnlyWindow();
else if (key == "P" || key == "<C-P>") else if (key == "P" || key == "<C-P>")
triggerAction(Core::Constants::GOTO_PREV_SPLIT); triggerAction(Core::Constants::GOTO_PREV_SPLIT);
else if (key == "S" || key == "<C-S>") else if (key == "S" || key == "<C-S>") {
triggerAction(Core::Constants::SPLIT); triggerAction(Core::Constants::SPLIT);
else if (key == "V" || key == "<C-V>") updateAllHightLights();
} else if (key == "V" || key == "<C-V>") {
triggerAction(Core::Constants::SPLIT_SIDE_BY_SIDE); triggerAction(Core::Constants::SPLIT_SIDE_BY_SIDE);
else if (key == "W" || key == "<C-W>") updateAllHightLights();
} else if (key == "W" || key == "<C-W>")
triggerAction(Core::Constants::GOTO_NEXT_SPLIT); triggerAction(Core::Constants::GOTO_NEXT_SPLIT);
else if (key.contains("RIGHT") || key == "L" || key == "<S-L>" || key == "<C-L>") else if (key.contains("RIGHT") || key == "L" || key == "<S-L>" || key == "<C-L>")
moveSomewhere(handler, &moveRightWeight, key == "<S-L>" ? -1 : count); moveSomewhere(handler, &moveRightWeight, key == "<S-L>" ? -1 : count);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 748 B

View File

@@ -73,6 +73,7 @@ expected_str<QMap<QString, QString>> parseDeviceInfo(const QByteArray &rawOutput
info[kOsVersion] = QLatin1String("%1 (%2)") info[kOsVersion] = QLatin1String("%1 (%2)")
.arg(device["deviceProperties"]["osVersionNumber"].toString(), .arg(device["deviceProperties"]["osVersionNumber"].toString(),
device["deviceProperties"]["osBuildUpdate"].toString()); device["deviceProperties"]["osBuildUpdate"].toString());
info[kProductType] = device["hardwareProperties"]["productType"].toString();
info[kCpuArchitecture] = device["hardwareProperties"]["cpuType"]["name"].toString(); info[kCpuArchitecture] = device["hardwareProperties"]["cpuType"]["name"].toString();
info[kUniqueDeviceId] = udid; info[kUniqueDeviceId] = udid;
return info; return info;

View File

@@ -13,6 +13,7 @@ const char kDeviceName[] = "deviceName";
const char kDeveloperStatus[] = "developerStatus"; const char kDeveloperStatus[] = "developerStatus";
const char kDeviceConnected[] = "deviceConnected"; const char kDeviceConnected[] = "deviceConnected";
const char kOsVersion[] = "osVersion"; const char kOsVersion[] = "osVersion";
const char kProductType[] = "productType";
const char kCpuArchitecture[] = "cpuArchitecture"; const char kCpuArchitecture[] = "cpuArchitecture";
const char kUniqueDeviceId[] = "uniqueDeviceId"; const char kUniqueDeviceId[] = "uniqueDeviceId";
const char vOff[] = "*off*"; const char vOff[] = "*off*";

View File

@@ -92,8 +92,9 @@ public:
Form { Form {
Tr::tr("Device name:"), iosDevice->deviceName(), br, Tr::tr("Device name:"), iosDevice->deviceName(), br,
Tr::tr("Identifier:"), iosDevice->uniqueInternalDeviceId(), br, Tr::tr("Identifier:"), iosDevice->uniqueInternalDeviceId(), br,
Tr::tr("Product type:"), iosDevice->productType(), br,
Tr::tr("CPU Architecture:"), iosDevice->cpuArchitecture(), br,
Tr::tr("OS Version:"), iosDevice->osVersion(), br, Tr::tr("OS Version:"), iosDevice->osVersion(), br,
Tr::tr("CPU Architecture:"), iosDevice->cpuArchitecture(),
noMargin noMargin
}.attachTo(this); }.attachTo(this);
// clang-format on // clang-format on
@@ -193,6 +194,11 @@ QString IosDevice::osVersion() const
return m_extraInfo.value(kOsVersion); return m_extraInfo.value(kOsVersion);
} }
QString IosDevice::productType() const
{
return m_extraInfo.value(kProductType);
}
QString IosDevice::cpuArchitecture() const QString IosDevice::cpuArchitecture() const
{ {
return m_extraInfo.value(kCpuArchitecture); return m_extraInfo.value(kCpuArchitecture);
@@ -227,6 +233,7 @@ IosDeviceManager::TranslationMap IosDeviceManager::translationMap()
tMap[QLatin1String("NO")] = Tr::tr("no"); tMap[QLatin1String("NO")] = Tr::tr("no");
tMap[QLatin1String("*unknown*")] = Tr::tr("unknown"); tMap[QLatin1String("*unknown*")] = Tr::tr("unknown");
tMap[kOsVersion] = Tr::tr("OS version"); tMap[kOsVersion] = Tr::tr("OS version");
tMap[kProductType] = Tr::tr("Product type");
translationMap = &tMap; translationMap = &tMap;
return tMap; return tMap;
} }

View File

@@ -37,6 +37,7 @@ public:
QString uniqueDeviceID() const; QString uniqueDeviceID() const;
QString uniqueInternalDeviceId() const; QString uniqueInternalDeviceId() const;
QString osVersion() const; QString osVersion() const;
QString productType() const;
QString cpuArchitecture() const; QString cpuArchitecture() const;
Utils::Port nextPort() const; Utils::Port nextPort() const;
Handler handler() const; Handler handler() const;

View File

@@ -813,14 +813,17 @@ void IosDebugSupport::start()
setStartMode(AttachToRemoteProcess); setStartMode(AttachToRemoteProcess);
setIosPlatform("remote-ios"); setIosPlatform("remote-ios");
const QString osVersion = dev->osVersion(); const QString osVersion = dev->osVersion();
const QString productType = dev->productType();
const QString cpuArchitecture = dev->cpuArchitecture(); const QString cpuArchitecture = dev->cpuArchitecture();
const FilePaths symbolsPathCandidates = { const FilePath home = FilePath::fromString(QDir::homePath());
FilePath::fromString(QDir::homePath() + "/Library/Developer/Xcode/iOS DeviceSupport/" const FilePaths symbolsPathCandidates
+ osVersion + " " + cpuArchitecture + "/Symbols"), = {home / "Library/Developer/Xcode/iOS DeviceSupport" / (productType + " " + osVersion)
FilePath::fromString(QDir::homePath() + "/Library/Developer/Xcode/iOS DeviceSupport/" / "Symbols",
+ osVersion + "/Symbols"), home / "Library/Developer/Xcode/iOS DeviceSupport"
IosConfigurations::developerPath().pathAppended( / (osVersion + " " + cpuArchitecture) / "Symbols",
"Platforms/iPhoneOS.platform/DeviceSupport/" + osVersion + "/Symbols")}; home / "Library/Developer/Xcode/iOS DeviceSupport" / osVersion / "Symbols",
IosConfigurations::developerPath() / "Platforms/iPhoneOS.platform/DeviceSupport"
/ osVersion / "Symbols"};
const FilePath deviceSdk = Utils::findOrDefault(symbolsPathCandidates, &FilePath::isDir); const FilePath deviceSdk = Utils::findOrDefault(symbolsPathCandidates, &FilePath::isDir);
if (deviceSdk.isEmpty()) { if (deviceSdk.isEmpty()) {

View File

@@ -6,7 +6,7 @@ The Lua plugin provides support for writing plugins using the Lua scripting lang
## Usage ## Usage
The plugin scans the folder `lua-plugins` folder inside the normal plugin folder of Qt Creator The plugin scans the normal plugin folders of Qt Creator
`ExtensionSystem::PluginManager::pluginPaths()`. It loads scripts from any folder that contains `ExtensionSystem::PluginManager::pluginPaths()`. It loads scripts from any folder that contains
a .lua script named the same as the folder. a .lua script named the same as the folder.
Whether or not the script is enabled is determined by the `disabledByDefault` field in the plugin Whether or not the script is enabled is determined by the `disabledByDefault` field in the plugin
@@ -17,7 +17,7 @@ table and the settings configured via the "About Plugins" dialog in Qt Creator.
A Lua script needs to provide the following table to be considered a plugin: A Lua script needs to provide the following table to be considered a plugin:
```lua ```lua
-- lua-plugins/myluaplugin/myluaplugin.lua -- myluaplugin/myluaplugin.lua
return { return {
name = "MyLuaPlugin", name = "MyLuaPlugin",
version = "1.0.0", version = "1.0.0",
@@ -40,7 +40,7 @@ Can contain newlines.
disabledByDefault = false, disabledByDefault = false,
dependencies = { dependencies = {
{ name="Core", version = "12.0.0" } { name="Core", version = "14.0.0" }
}, },
} --[[@as QtcPlugin]] } --[[@as QtcPlugin]]
``` ```
@@ -50,13 +50,13 @@ It must only return the plugin specification table and not execute or require an
Use `require` to load other files from within the setup function. Use `require` to load other files from within the setup function.
```lua ```lua
-- lua-plugins/myluaplugin/myluaplugin.lua -- myluaplugin/myluaplugin.lua
return { return {
-- ... required fields omitted .. -- ... required fields omitted ..
setup = function() require 'init'.setup() end, setup = function() require 'init'.setup() end,
} --[[@as QtcPlugin]] } --[[@as QtcPlugin]]
-- lua-plugins/myluaplugin/init.lua -- myluaplugin/init.lua
local function setup() local function setup()
print("Hello from Lua!") print("Hello from Lua!")
end end

View File

@@ -49,24 +49,6 @@ public:
} }
}; };
struct Arguments
{
std::optional<FilePath> loadPlugin;
};
Arguments parseArguments(const QStringList &arguments)
{
Arguments args;
for (int i = 0; i < arguments.size() - 1; ++i) {
if (arguments.at(i) == QLatin1String("-loadluaplugin")) {
const QString path(arguments.at(i + 1));
args.loadPlugin = FilePath::fromUserInput(path);
i++; // skip the argument
}
}
return args;
}
class LuaPlugin : public IPlugin class LuaPlugin : public IPlugin
{ {
Q_OBJECT Q_OBJECT
@@ -74,18 +56,15 @@ class LuaPlugin : public IPlugin
private: private:
std::unique_ptr<LuaEngine> m_luaEngine; std::unique_ptr<LuaEngine> m_luaEngine;
Arguments m_arguments;
public: public:
LuaPlugin() {} LuaPlugin() {}
~LuaPlugin() override = default; ~LuaPlugin() override = default;
bool initialize(const QStringList &arguments, QString *) final void initialize() final
{ {
m_luaEngine.reset(new LuaEngine()); m_luaEngine.reset(new LuaEngine());
m_arguments = parseArguments(arguments);
addAsyncModule(); addAsyncModule();
addFetchModule(); addFetchModule();
addActionModule(); addActionModule();
@@ -100,27 +79,25 @@ public:
addInstallModule(); addInstallModule();
Core::JsExpander::registerGlobalObject("Lua", [] { return new LuaJsExtension(); }); Core::JsExpander::registerGlobalObject("Lua", [] { return new LuaJsExtension(); });
return true;
} }
bool delayedInitialize() final bool delayedInitialize() final
{ {
scanForPlugins(transform(PluginManager::pluginPaths(), [](const FilePath &path) { scanForPlugins(PluginManager::pluginPaths());
return path / "lua-plugins";
}));
return true; return true;
} }
void scanForPlugins(const FilePaths &paths) void scanForPlugins(const FilePaths &pluginPaths)
{ {
QSet<PluginSpec *> plugins; QSet<PluginSpec *> plugins;
for (const FilePath &path : paths) { for (const FilePath &path : pluginPaths) {
FilePaths folders = path.dirEntries(FileFilter({}, QDir::Dirs | QDir::NoDotAndDotDot)); FilePaths folders = path.dirEntries(FileFilter({}, QDir::Dirs | QDir::NoDotAndDotDot));
for (const FilePath &folder : folders) { for (const FilePath &folder : folders) {
const FilePath script = folder / (folder.baseName() + ".lua"); const FilePath script = folder / (folder.baseName() + ".lua");
if (!script.exists())
continue;
const expected_str<LuaPluginSpec *> result = m_luaEngine->loadPlugin(script); const expected_str<LuaPluginSpec *> result = m_luaEngine->loadPlugin(script);
if (!result) { if (!result) {
@@ -135,23 +112,6 @@ public:
} }
} }
if (m_arguments.loadPlugin) {
const FilePath folder = *m_arguments.loadPlugin;
const FilePath script = folder / (folder.baseName() + ".lua");
const expected_str<LuaPluginSpec *> result = m_luaEngine->loadPlugin(script);
if (!result) {
qWarning() << "Failed to load plugin" << script << ":" << result.error();
MessageManager::writeFlashing(tr("Failed to load plugin %1: %2")
.arg(script.toUserOutput())
.arg(result.error()));
} else {
(*result)->setEnabledBySettings(true);
plugins.insert(*result);
}
}
PluginManager::addPlugins({plugins.begin(), plugins.end()}); PluginManager::addPlugins({plugins.begin(), plugins.end()});
PluginManager::loadPluginsAtRuntime(plugins); PluginManager::loadPluginsAtRuntime(plugins);
} }

View File

@@ -9,6 +9,7 @@
#include <extensionsystem/extensionsystemtr.h> #include <extensionsystem/extensionsystemtr.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/appinfo.h>
#include <utils/expected.h> #include <utils/expected.h>
#include <QJsonDocument> #include <QJsonDocument>
@@ -76,6 +77,19 @@ ExtensionSystem::IPlugin *LuaPluginSpec::plugin() const
return nullptr; return nullptr;
} }
bool LuaPluginSpec::provides(PluginSpec *spec, const PluginDependency &dependency) const
{
if (QString::compare(dependency.name, spec->name(), Qt::CaseInsensitive) != 0)
return false;
// Since we first released the lua support with Qt Creator 14.0.0, but the internal version
// number was still 13.0.82, we needed to special case this version.
if (versionCompare(dependency.version, "14.0.0") <= 0)
return true;
return (versionCompare(spec->version(), dependency.version) >= 0);
}
// LuaPluginSpec::For internal use {} // LuaPluginSpec::For internal use {}
bool LuaPluginSpec::loadLibrary() bool LuaPluginSpec::loadLibrary()
{ {

View File

@@ -44,6 +44,9 @@ public:
ExtensionSystem::IPlugin *plugin() const override; ExtensionSystem::IPlugin *plugin() const override;
bool provides(
PluginSpec *spec, const ExtensionSystem::PluginDependency &dependency) const override;
// For internal use only // For internal use only
bool loadLibrary() override; bool loadLibrary() override;
bool initializePlugin() override; bool initializePlugin() override;

View File

@@ -4,30 +4,30 @@ local action = {}
---@enum CommandAttributes ---@enum CommandAttributes
action.CommandAttribute = { action.CommandAttribute = {
---Hide the command from the menu ---Hide the command from the menu.
CA_Hide = 1, CA_Hide = 1,
---Update the text of the command ---Update the text of the command.
CA_UpdateText = 2, CA_UpdateText = 2,
---Update the icon of the command ---Update the icon of the command.
CA_UpdateIcon = 4, CA_UpdateIcon = 4,
---The command cannot be configured ---The command cannot be configured.
CA_NonConfigurable = 8, CA_NonConfigurable = 8,
} }
---@class ActionOptions ---@class ActionOptions
---@field context? string The context in which the action is available ---@field context? string The context in which the action is available.
---@field text? string The text to display for the action ---@field text? string The text to display for the action.
---@field iconText? string The icon text to display for the action ---@field iconText? string The icon text to display for the action.
---@field toolTip? string The tooltip to display for the action ---@field toolTip? string The tooltip to display for the action.
---@field onTrigger? function The callback to call when the action is triggered ---@field onTrigger? function The callback to call when the action is triggered.
---@field commandAttributes? CommandAttributes The attributes of the action ---@field commandAttributes? CommandAttributes The attributes of the action.
---@field commandDescription? string The description of the command ---@field commandDescription? string The description of the command.
---@field defaultKeySequence? string The default key sequence for the action ---@field defaultKeySequence? string The default key sequence for the action.
---@field defaultKeySequences? string[] The default key sequences for the action ---@field defaultKeySequences? string[] The default key sequences for the action.
local ActionOptions = {} local ActionOptions = {}
---Creates a new Action ---Creates a new Action.
---@param id string The id of the action ---@param id string The id of the action.
---@param options ActionOptions ---@param options ActionOptions
function action.create(id, options) end function action.create(id, options) end

View File

@@ -20,7 +20,7 @@ local async = {}
function async.sync(func) end function async.sync(func) end
---@async ---@async
---Calls an async function and waits for it to finish. **Must** be called from async.sync() ---Calls an async function and waits for it to finish. **Must** be called from async.sync().
--- ---
--- Example: --- Example:
--- ```lua --- ```lua
@@ -39,7 +39,7 @@ function async.sync(func) end
function async.wait(func) end function async.wait(func) end
---@async ---@async
---Calls multiple async functions and waits for all of them to finish. **Must** be called from async.sync() ---Calls multiple async functions and waits for all of them to finish. **Must** be called from async.sync().
--- ---
--- Example: --- Example:
--- ```lua --- ```lua

View File

@@ -16,10 +16,10 @@ Core.GeneratedFile.Attribute = {
---@field filePath FilePath ---@field filePath FilePath
---@field contents string ---@field contents string
---@field isBinary boolean ---@field isBinary boolean
---@field attributes Attribute A combination of Attribute ---@field attributes Attribute A combination of Attribute.
Core.GeneratedFile = {} Core.GeneratedFile = {}
---Create a new GeneratedFile ---Create a new GeneratedFile.
---@return GeneratedFile ---@return GeneratedFile
function Core.GeneratedFile.new() end function Core.GeneratedFile.new() end

View File

@@ -1,12 +1,12 @@
---@meta Fetch ---@meta Fetch
local Fetch = {} local Fetch = {}
---A network reply from fetch ---A network reply from fetch.
---@class QNetworkReply ---@class QNetworkReply
---@field error integer The error code of the reply or 0 if no error ---@field error integer The error code of the reply or 0 if no error.
local QNetworkReply = {} local QNetworkReply = {}
---Returns the data of the reply ---Returns the data of the reply.
---@return string ---@return string
function QNetworkReply:readAll() end function QNetworkReply:readAll() end
@@ -16,15 +16,15 @@ function QNetworkReply:readAll() end
function Fetch.fetch(options) end function Fetch.fetch(options) end
--@param options FetchOptions --@param options FetchOptions
--@param callback function The callback to call when the fetch is done --@param callback function The callback to call when the fetch is done.
function Fetch.fetch_cb(options, callback) end function Fetch.fetch_cb(options, callback) end
---@class FetchOptions ---@class FetchOptions
---@field url string The url to fetch ---@field url string The url to fetch.
---@field method? string The method to use (GET, POST, ...), default is GET ---@field method? string The method to use (GET, POST, ...), default is GET.
---@field headers? table The headers to send ---@field headers? table The headers to send.
---@field body? string The body to send ---@field body? string The body to send.
---@field convertToTable? boolean If true, the resulting data will expect JSON and converted it to a table ---@field convertToTable? boolean If true, the resulting data will expect JSON and converted it to a table.
local FetchOptions = {} local FetchOptions = {}
return Fetch return Fetch

View File

@@ -2,11 +2,11 @@
local gui = {} local gui = {}
---The base class of all ui related classes ---The base class of all ui related classes.
---@class Object ---@class Object
gui.Object = {} gui.Object = {}
---The base class of all gui layout classes ---The base class of all gui layout classes.
---@class Layout : Object ---@class Layout : Object
gui.Layout = {} gui.Layout = {}
@@ -26,14 +26,14 @@ local column = {}
---@return Column ---@return Column
function gui.Column(children) end function gui.Column(children) end
---A group box with a title ---A group box with a title.
---@class Group : Widget ---@class Group : Widget
local group = {} local group = {}
---@return Group ---@return Group
function gui.Group(children) end function gui.Group(children) end
---Row layout ---Row layout.
---@class Row : Layout ---@class Row : Layout
local row = {} local row = {}
@@ -41,7 +41,7 @@ local row = {}
---@return Row ---@return Row
function gui.Row(children) end function gui.Row(children) end
---Flow layout ---Flow layout.
---@class Flow : Layout ---@class Flow : Layout
local flow = {} local flow = {}
@@ -49,7 +49,7 @@ local flow = {}
---@return Flow ---@return Flow
function gui.Flow(children) end function gui.Flow(children) end
---Grid layout ---Grid layout.
---@class Grid : Layout ---@class Grid : Layout
local grid = {} local grid = {}
@@ -57,7 +57,7 @@ local grid = {}
---@return Grid ---@return Grid
function gui.Grid(children) end function gui.Grid(children) end
---Form layout ---Form layout.
---@class Form : Layout ---@class Form : Layout
local form = {} local form = {}
@@ -66,7 +66,7 @@ local form = {}
function gui.Form(children) end function gui.Form(children) end
---A stack of multiple widgets ---A stack of multiple widgets.
---@class Stack : Widget ---@class Stack : Widget
local stack = {} local stack = {}
@@ -74,7 +74,7 @@ local stack = {}
---@return Stack ---@return Stack
function gui.Stack(children) end function gui.Stack(children) end
---A Tab widget ---A Tab widget.
---@class Tab : Widget ---@class Tab : Widget
local tab = {} local tab = {}
@@ -82,7 +82,7 @@ local tab = {}
---@return Tab ---@return Tab
function gui.Tab(children) end function gui.Tab(children) end
---A Multiline text edit ---A Multiline text edit.
---@class TextEdit : Widget ---@class TextEdit : Widget
local textEdit = {} local textEdit = {}
@@ -90,7 +90,6 @@ local textEdit = {}
---@return TextEdit ---@return TextEdit
function gui.TextEdit(children) end function gui.TextEdit(children) end
---A PushButton
---@class PushButton : Widget ---@class PushButton : Widget
local pushButton = {} local pushButton = {}
@@ -98,7 +97,6 @@ local pushButton = {}
---@return PushButton ---@return PushButton
function gui.PushButton(children) end function gui.PushButton(children) end
---A Label
---@class Label : LayoutItem ---@class Label : LayoutItem
local label = {} local label = {}
@@ -106,7 +104,6 @@ local label = {}
---@return Label ---@return Label
function gui.Label(children) end function gui.Label(children) end
---A SpinBox
---@class SpinBox : Widget ---@class SpinBox : Widget
local spinBox = {} local spinBox = {}
@@ -114,7 +111,6 @@ local spinBox = {}
---@return SpinBox ---@return SpinBox
function gui.SpinBox(children) end function gui.SpinBox(children) end
---A Splitter
---@class Splitter : Widget ---@class Splitter : Widget
local splitter = {} local splitter = {}
@@ -122,7 +118,6 @@ local splitter = {}
---@return Splitter ---@return Splitter
function gui.Splitter(children) end function gui.Splitter(children) end
---A Toolbar
---@class ToolBar : Widget ---@class ToolBar : Widget
local toolBar = {} local toolBar = {}
@@ -130,7 +125,6 @@ local toolBar = {}
---@return ToolBar ---@return ToolBar
function gui.ToolBar(children) end function gui.ToolBar(children) end
---A TabWidget
---@class TabWidget : Widget ---@class TabWidget : Widget
local tabWidget = {} local tabWidget = {}
@@ -142,40 +136,40 @@ function gui.TabWidget(children) end
---@param child Layout|string|BaseAspect|function ---@param child Layout|string|BaseAspect|function
---@return TabWidget ---@return TabWidget
function gui.TabWidget(name, child) end function gui.TabWidget(name, child) end
---A "Line break" in the gui ---A "Line break" in the gui.
function gui.br() end function gui.br() end
---A "Stretch" in the layout ---A "Stretch" in the layout.
function gui.st() end function gui.st() end
---An empty grid cell in a grid layout ---An empty grid cell in a grid layout.
function gui.empty() end function gui.empty() end
---A horizontal line in the layout ---A horizontal line in the layout.
function gui.hr() end function gui.hr() end
---Clears the margin of the layout ---Clears the margin of the layout.
function gui.noMargin() end function gui.noMargin() end
---Sets the margin of the layout to the default value ---Sets the margin of the layout to the default value.
function gui.normalMargin() end function gui.normalMargin() end
---Sets the alignment of a Grid layout according to the Form layout rules ---Sets the alignment of a Grid layout according to the Form layout rules.
function gui.withFormAlignment() end function gui.withFormAlignment() end
---Sets the size of the parent object if possible ---Sets the size of the parent object if possible.
function gui.resize(width, height) end function gui.resize(width, height) end
---Sets the spacing of the gui ---Sets the spacing of the gui.
function gui.spacing(spacing) end function gui.spacing(spacing) end
---Sets the field growth policy of the gui ---Sets the field growth policy of the gui.
function gui.fieldGrowthPolicy(policy) end function gui.fieldGrowthPolicy(policy) end
---Sets the onClicked handler of the parent object if possible ---Sets the onClicked handler of the parent object if possible.
function gui.onClicked(f) end function gui.onClicked(f) end
---Sets the onTextChanged handler of the parent object if possible ---Sets the onTextChanged handler of the parent object if possible.
function gui.onTextChanged(f) end function gui.onTextChanged(f) end
return gui return gui

View File

@@ -3,26 +3,26 @@
local Install = {} local Install = {}
---@class PackageInfo ---@class PackageInfo
---@field name string The name of the package ---@field name string The name of the package.
---@field version string The version of the package ---@field version string The version of the package.
---@field path FilePath The path to the package ---@field path FilePath The path to the package.
local PackageInfo = {} local PackageInfo = {}
---@class InstallOptions ---@class InstallOptions
---@field name string The name of the package to install ---@field name string The name of the package to install.
---@field url string The url to fetch the package from ---@field url string The url to fetch the package from.
---@field version string The version of the package to install ---@field version string The version of the package to install.
local InstallOptions = {} local InstallOptions = {}
---Install something ---Install something
---@param msg string The message to display to the user asking for permission to install ---@param msg string The message to display to the user asking for permission to install.
---@param options InstallOptions|[InstallOptions] The options to install ---@param options InstallOptions|[InstallOptions] The options to install.
---@return boolean Result Whether the installation was successful ---@return boolean Result Whether the installation was successful.
---@return string Error The error message if the installation failed. ---@return string Error The error message if the installation failed.
function Install.install(msg, options) end function Install.install(msg, options) end
---Get the package info ---Get the package info
---@param name any The name of the package ---@param name any The name of the package.
---@return PackageInfo ---@return PackageInfo
function Install.packageInfo(name) end function Install.packageInfo(name) end

View File

@@ -1,38 +1,38 @@
---@meta LSP ---@meta LSP.
local lsp = {} local lsp = {}
---@class ClientOptions ---@class ClientOptions
---@field name string The name under which to register the language server. ---@field name string The name under which to register the language server.
---@field cmd function|string[] The command to start the language server, or a function returning a string[]. ---@field cmd function|string[] The command to start the language server, or a function returning a string[].
---@field transport? "stdio"|"localsocket" Defaults to stdio ---@field transport? "stdio"|"localsocket" Defaults to stdio.
---@field serverName? string The socket path when transport == "localsocket" ---@field serverName? string The socket path when transport == "localsocket".
---@field languageFilter LanguageFilter The language filter deciding which files to open with the language server ---@field languageFilter LanguageFilter The language filter deciding which files to open with the language server.
---@field startBehavior? "AlwaysOn"|"RequiresFile"|"RequiresProject" ---@field startBehavior? "AlwaysOn"|"RequiresFile"|"RequiresProject"
---@field initializationOptions? table|string The initialization options to pass to the language server, either a json string, or a table ---@field initializationOptions? table|string The initialization options to pass to the language server, either a JSON string, or a table.
---@field settings? AspectContainer ---@field settings? AspectContainer
---@field onStartFailed? function This callback is called when client failed to start. ---@field onStartFailed? function This callback is called when client failed to start.
local ClientOptions = {} local ClientOptions = {}
---@class LanguageFilter ---@class LanguageFilter
---@field patterns? string[] The file patterns supported by the language server ---@field patterns? string[] The file patterns supported by the language server.
---@field mimeTypes? string[] The mime types supported by the language server ---@field mimeTypes? string[] The mime types supported by the language server.
local LanguageFilter = {} local LanguageFilter = {}
---@class Client ---@class Client
---@field on_instance_start function The callback to call when a language client starts ---@field on_instance_start function The callback to call when a language client starts.
lsp.Client = {} lsp.Client = {}
---@param msg string The name of the message to handle ---@param msg string The name of the message to handle.
---@param callback function The callback to call when the message is received ---@param callback function The callback to call when the message is received.
---Registers a message handler for the message named 'msg' ---Registers a message handler for the message named 'msg'.
function lsp.Client:registerMessage(msg, callback) end function lsp.Client:registerMessage(msg, callback) end
---@param msg table the message to send ---@param msg table the message to send.
---Sends a message to the language server ---Sends a message to the language server.
function lsp.Client:sendMessage(msg, callback) end function lsp.Client:sendMessage(msg, callback) end
---Creates a new Language Client ---Creates a new Language Client.
---@param options ClientOptions ---@param options ClientOptions
---@return Client ---@return Client
function lsp.Client.create(options) end function lsp.Client.create(options) end

View File

@@ -2,15 +2,15 @@
local messagemanager = {} local messagemanager = {}
---Writes a message to the Output pane ---Writes a message to the Output pane.
---@param ... any ---@param ... any
function messagemanager.writeSilently(...) end function messagemanager.writeSilently(...) end
---Writes a message to the Output pane and flashes the pane if its not open ---Writes a message to the Output pane and flashes the pane if its not open.
---@param ... any ---@param ... any
function messagemanager.writeFlashing(...) end function messagemanager.writeFlashing(...) end
---Writes a message to the Output pane and opens the pane if its not open ---Writes a message to the Output pane and opens the pane if its not open.
---@param ... any ---@param ... any
function messagemanager.writeDisrupting(...) end function messagemanager.writeDisrupting(...) end

View File

@@ -4,14 +4,14 @@ local process = {}
---@async ---@async
---Runs a command in a terminal, has to be called from a coroutine! ---Runs a command in a terminal, has to be called from a coroutine!
---@param cmd string The command to run ---@param cmd string The command to run.
---@return number The exit code of the command ---@return number exitCode The exit code of the command.
function process.runInTerminal(cmd) end function process.runInTerminal(cmd) end
---@async ---@async
---Runs a command and returns the output! ---Runs a command and returns the output!
---@param cmd string The command to run ---@param cmd string The command to run.
---@return string The output of the command ---@return string output The output of the command.
function process.commandOutput(cmd) end function process.commandOutput(cmd) end
return process return process

View File

@@ -29,7 +29,7 @@ QtcPlugin = {}
---@class QtcPluginDependency ---@class QtcPluginDependency
---@field Name string The name of the dependency. ---@field Name string The name of the dependency.
---@field Version string The version of the dependency. (`major.minor.patch`) ---@field Version string The version of the dependency. (`major.minor.patch`)
---@field Required boolean Whether the dependency is required or not. ---@field Required? "required"|"optional"|"test" Whether the dependency is required or not. (Default: "required")
QtcPluginDependency = {} QtcPluginDependency = {}

View File

@@ -8,48 +8,48 @@ local settings = {}
---@class BaseAspect ---@class BaseAspect
settings.BaseAspect = {} settings.BaseAspect = {}
---Applies the changes from its volatileValue to its value ---Applies the changes from its volatileValue to its value.
function settings.BaseAspect:apply() end function settings.BaseAspect:apply() end
---@class AspectCreate ---@class AspectCreate
---@field settingsKey? string The settings key of the aspect ---@field settingsKey? string The settings key of the aspect.
---@field displayName? string The display name of the aspect ---@field displayName? string The display name of the aspect.
---@field labelText? string The label text of the aspect ---@field labelText? string The label text of the aspect.
---@field toolTip? string The tool tip of the aspect ---@field toolTip? string The tool tip of the aspect.
---@field enabler? BoolAspect Enable / Disable this aspect based on the state of the `enabler` ---@field enabler? BoolAspect Enable / Disable this aspect based on the state of the `enabler`.
---@field onValueChanged? function () Called when the value of the aspect changes ---@field onValueChanged? function () Called when the value of the aspect changes.
---@field onVolatileValueChanged? function () Called when the volatile value of the aspect changes ---@field onVolatileValueChanged? function () Called when the volatile value of the aspect changes.
local AspectCreate = {} local AspectCreate = {}
---The base class of most typed aspects ---The base class of most typed aspects.
---@generic T ---@generic T
---@class TypedAspect<T> : BaseAspect ---@class TypedAspect<T> : BaseAspect
---@field value `T` The value of the aspect ---@field value `T` The value of the aspect.
---@field volatileValue `T` The temporary value of the aspect ---@field volatileValue `T` The temporary value of the aspect.
---@field defaultValue `T` The default value of the aspect ---@field defaultValue `T` The default value of the aspect.
local TypedAspect = {} local TypedAspect = {}
---@generic T ---@generic T
---@class TypedAspectCreate<T> : AspectCreate ---@class TypedAspectCreate<T> : AspectCreate
---@field defaultValue `T` The default value of the aspect ---@field defaultValue `T` The default value of the aspect.
local TypedAspectCreate = {} local TypedAspectCreate = {}
---A container for aspects ---A container for aspects.
---@class AspectContainer : BaseAspect ---@class AspectContainer : BaseAspect
settings.AspectContainer = {} settings.AspectContainer = {}
---Options for creating an AspectContainer ---Options for creating an AspectContainer.
---@class AspectContainerCreate ---@class AspectContainerCreate
---@field autoApply? boolean Whether the aspects should be applied automatically or not ---@field autoApply? boolean Whether the aspects should be applied automatically or not.
AspectContainerCreate = {} AspectContainerCreate = {}
---Create a new AspectContainer ---Create a new AspectContainer.
---@param options AspectContainerCreate ---@param options AspectContainerCreate
---@return AspectContainer ---@return AspectContainer
function settings.AspectContainer.create(options) end function settings.AspectContainer.create(options) end
---A aspect containing a boolean value ---A aspect containing a boolean value.
---@class BoolAspect : TypedAspect<boolean> ---@class BoolAspect : TypedAspect<boolean>
settings.BoolAspect = {} settings.BoolAspect = {}
@@ -63,7 +63,7 @@ settings.LabelPlacement = {
---@field labelPlacement? LabelPlacement: ---@field labelPlacement? LabelPlacement:
BoolAspectCreate = {} BoolAspectCreate = {}
---Create a new BoolAspect ---Create a new BoolAspect.
---@param options BoolAspectCreate ---@param options BoolAspectCreate
---@return BoolAspect ---@return BoolAspect
function settings.BoolAspect.create(options) end function settings.BoolAspect.create(options) end
@@ -86,15 +86,15 @@ settings.StringDisplayStyle = {
}; };
---@class StringAspectCreate : TypedAspectCreate<string> ---@class StringAspectCreate : TypedAspectCreate<string>
---@field displayStyle? StringDisplayStyle The display type of the aspect ---@field displayStyle? StringDisplayStyle The display type of the aspect.
---@field historyId? string The history id of the aspect ---@field historyId? string The history id of the aspect.
---@field valueAcceptor? function string (oldvalue: string, newValue: string) ---@field valueAcceptor? function string (oldvalue: string, newValue: string)
---@field showToolTipOnLabel? boolean ---@field showToolTipOnLabel? boolean
---@field displayFilter? function string (value: string) ---@field displayFilter? function string (value: string)
---@field placeHolderText? string ---@field placeHolderText? string
---@field acceptRichText? boolean ---@field acceptRichText? boolean
---@field autoApplyOnEditingFinished? boolean ---@field autoApplyOnEditingFinished? boolean
---@field elideMode? Qt.TextElideMode The elide mode of the aspect ---@field elideMode? Qt.TextElideMode The elide mode of the aspect.
StringAspectCreate = {} StringAspectCreate = {}
---@class StringAspect : TypedAspect<string> ---@class StringAspect : TypedAspect<string>
@@ -116,9 +116,9 @@ settings.Kind = {
}; };
---@class FilePathAspectCreate ---@class FilePathAspectCreate
---@field expectedKind? Kind The kind of path we want to select ---@field expectedKind? Kind The kind of path we want to select.
---@field historyId? string The history id of the aspect ---@field historyId? string The history id of the aspect.
---@field defaultPath? FilePath The default path of the aspect ---@field defaultPath? FilePath The default path of the aspect.
---@field promptDialogFilter? string ---@field promptDialogFilter? string
---@field promptDialogTitle? string ---@field promptDialogTitle? string
---@field commandVersionArguments? string[] ---@field commandVersionArguments? string[]
@@ -136,8 +136,8 @@ settings.Kind = {
FilePathAspectCreate = {} FilePathAspectCreate = {}
---@class FilePathAspect ---@class FilePathAspect
---@field expandedValue FilePath The expanded value of the aspect ---@field expandedValue FilePath The expanded value of the aspect.
---@field defaultPath FilePath The default path of the aspect ---@field defaultPath FilePath The default path of the aspect.
settings.FilePathAspect = {} settings.FilePathAspect = {}
---Create a new FilePathAspect ---Create a new FilePathAspect
@@ -146,7 +146,7 @@ settings.FilePathAspect = {}
function settings.FilePathAspect.create(options) end function settings.FilePathAspect.create(options) end
---Set the value of the aspect ---Set the value of the aspect
---@param value string|FilePath The value to set ---@param value string|FilePath The value to set.
function settings.FilePathAspect:setValue(value) end function settings.FilePathAspect:setValue(value) end
settings.IntegerAspect = {} settings.IntegerAspect = {}
@@ -179,7 +179,7 @@ settings.OptionsPage = {}
---@field aspectContainer AspectContainer ---@field aspectContainer AspectContainer
OptionsPageCreate = {} OptionsPageCreate = {}
---Creates a new OptionsPage ---Creates a new OptionsPage.
---@param options OptionsPageCreate ---@param options OptionsPageCreate
---@return OptionsPage ---@return OptionsPage
function settings.OptionsPage.create(options) end function settings.OptionsPage.create(options) end

View File

@@ -1,36 +1,36 @@
---@meta ---@meta
---@class QRect ---@class QRect
---@field x integer The x position of the rectangle ---@field x integer The x position of the rectangle.
---@field y integer The y position of the rectangle ---@field y integer The y position of the rectangle.
---@field width integer The width of the rectangle ---@field width integer The width of the rectangle.
---@field height integer The height of the rectangle ---@field height integer The height of the rectangle.
QRect = {} QRect = {}
---@class QSize ---@class QSize
---@field width integer The width of the size ---@field width integer The width of the size.
---@field height integer The height of the size ---@field height integer The height of the size.
QSize = {} QSize = {}
---@class QPoint ---@class QPoint
---@field x integer The x position of the point ---@field x integer The x position of the point.
---@field y integer The y position of the point ---@field y integer The y position of the point.
QPoint = {} QPoint = {}
---@class QPointF ---@class QPointF
---@field x number The x position of the floating point ---@field x number The x position of the floating point.
---@field y number The y position of the floating point ---@field y number The y position of the floating point.
QPointF = {} QPointF = {}
---@class QSizeF ---@class QSizeF
---@field width number The width of the floating point size ---@field width number The width of the floating point size.
---@field height number The height of the floating point size ---@field height number The height of the floating point size.
QSizeF = {} QSizeF = {}
---@class QRectF ---@class QRectF
---@field x number The x position of the floating point rectangle ---@field x number The x position of the floating point rectangle.
---@field y number The y position of the floating point rectangle ---@field y number The y position of the floating point rectangle.
---@field width number The width of the floating point rectangle ---@field width number The width of the floating point rectangle.
---@field height number The height of the floating point rectangle ---@field height number The height of the floating point rectangle.
QRectF = {} QRectF = {}

View File

@@ -3,99 +3,99 @@
local utils = {} local utils = {}
---Suspends the current coroutine for the given amount of milliseconds. Call `a.wait` on the returned value to get the result. ---Suspends the current coroutine for the given amount of milliseconds. Call `a.wait` on the returned value to get the result.
---@param ms number The amount of milliseconds to wait ---@param ms number The amount of milliseconds to wait.
function utils.waitms(ms) end function utils.waitms(ms) end
---Calls the callback after the given amount of milliseconds ---Calls the callback after the given amount of milliseconds.
---@param ms number The amount of milliseconds to wait ---@param ms number The amount of milliseconds to wait.
---@param callback function The callback to call ---@param callback function The callback to call.
function utils.waitms_cb(ms, callback) end function utils.waitms_cb(ms, callback) end
---@class FilePath ---@class FilePath
utils.FilePath = {} utils.FilePath = {}
---@param path string The path to convert ---@param path string The path to convert.
---@return FilePath The converted path ---@return FilePath The converted path.
---Convert and clean a path, returning a FilePath object ---Convert and clean a path, returning a FilePath object.
function utils.FilePath.fromUserInput(path) end function utils.FilePath.fromUserInput(path) end
---@return FilePath The new absolute path ---@return FilePath The new absolute path.
---Searches for the path inside the PATH environment variable. Call `a.wait` on the returned value to get the result. ---Searches for the path inside the PATH environment variable. Call `a.wait` on the returned value to get the result.
function utils.FilePath:searchInPath() end function utils.FilePath:searchInPath() end
---@class (exact) DirEntriesOptions ---@class (exact) DirEntriesOptions
---@field nameFilters? string[] The name filters to use (e.g. "*.lua"), defaults to all files ---@field nameFilters? string[] The name filters to use (e.g. "*.lua"), defaults to all files.
---@field fileFilters? integer The filters to use (combination of QDir.Filters.*), defaults to QDir.Filters.NoFilter ---@field fileFilters? integer The filters to use (combination of QDir.Filters.*), defaults to QDir.Filters.NoFilter.
---@field flags? integer The iterator flags (combination of QDirIterator.Flags.*), defaults to QDirIterator.Flags.NoIteratorFlags ---@field flags? integer The iterator flags (combination of QDirIterator.Flags.*), defaults to QDirIterator.Flags.NoIteratorFlags.
---Returns all entries in the directory. Call `a.wait` on the returned value to get the result. ---Returns all entries in the directory. Call `a.wait` on the returned value to get the result.
---@param options DirEntriesOptions ---@param options DirEntriesOptions
---@return FilePath[] ---@return FilePath[]
function utils.FilePath:dirEntries(options) end function utils.FilePath:dirEntries(options) end
---Returns the FilePath as it should be displayed to the user ---Returns the FilePath as it should be displayed to the user.
---@return string ---@return string
function utils.FilePath:toUserOutput() end function utils.FilePath:toUserOutput() end
---Returns whether the target exists ---Returns whether the target exists.
---@return boolean ---@return boolean
function utils.FilePath:exists() end function utils.FilePath:exists() end
---Returns whether the target is a file and executable ---Returns whether the target is a file and executable.
---@return boolean ---@return boolean
function utils.FilePath:isExecutableFile() end function utils.FilePath:isExecutableFile() end
---Returns the path portion of FilePath as a string in the hosts native format ---Returns the path portion of FilePath as a string in the hosts native format.
---@return string ---@return string
function utils.FilePath:nativePath() end function utils.FilePath:nativePath() end
---Returns the last part of the path ---Returns the last part of the path.
---@return string ---@return string
function utils.FilePath:fileName() end function utils.FilePath:fileName() end
---Returns the current working path of Qt Creator ---Returns the current working path of Qt Creator.
---@return FilePath ---@return FilePath
function utils.FilePath.currentWorkingPath() end function utils.FilePath.currentWorkingPath() end
---Returns a new FilePath with the given tail appended ---Returns a new FilePath with the given tail appended.
---@param tail string|FilePath The tail to append ---@param tail string|FilePath The tail to append.
---@return FilePath ---@return FilePath
function utils.FilePath:resolvePath(tail) end function utils.FilePath:resolvePath(tail) end
---Returns the parent directory of the path ---Returns the parent directory of the path.
---@return FilePath ---@return FilePath
function utils.FilePath:parentDir() end function utils.FilePath:parentDir() end
---If the path targets a symlink, this function returns the target of the symlink ---If the path targets a symlink, this function returns the target of the symlink.
---@return FilePath The resolved path ---@return FilePath resolvedPath The resolved path.
function utils.FilePath:resolveSymlinks() end function utils.FilePath:resolveSymlinks() end
---Returns the suffix of the path (e.g. "test.ui.qml" -> ".qml") ---Returns the suffix of the paths (e.g. "test.ui.qml" -> ".qml").
---@return string ---@return string
function utils.FilePath:suffix() end function utils.FilePath:suffix() end
---Returns the complete suffix of the path (e.g. "test.ui.qml" -> "ui.qml") ---Returns the complete suffix of the paths (e.g. "test.ui.qml" -> "ui.qml").
---@return string ---@return string
function utils.FilePath:completeSuffix() end function utils.FilePath:completeSuffix() end
---Returns whether the path is absolute ---Returns whether the path is absolute.
---@return boolean ---@return boolean
function utils.FilePath:isAbsolutePath() end function utils.FilePath:isAbsolutePath() end
---@class HostOsInfo ---@class HostOsInfo
---@field os "mac"|"windows"|"linux" The current host operating system ---@field os "mac"|"windows"|"linux" The current host operating system.
---@field architecture "unknown"|"x86"|"x86_64"|"itanium"|"arm"|"arm64" The current host architecture ---@field architecture "unknown"|"x86"|"x86_64"|"itanium"|"arm"|"arm64" The current host architecture.
utils.HostOsInfo = {} utils.HostOsInfo = {}
---Returns whether the host operating system is windows ---Returns whether the host operating system is windows.
---@return boolean ---@return boolean
function utils.HostOsInfo.isWindowsHost() end function utils.HostOsInfo.isWindowsHost() end
---Returns whether the host operating system is mac ---Returns whether the host operating system is mac.
---@return boolean ---@return boolean
function utils.HostOsInfo.isMacHost() end function utils.HostOsInfo.isMacHost() end
---Returns whether the host operating system is linux ---Returns whether the host operating system is linux.
---@return boolean ---@return boolean
function utils.HostOsInfo.isLinuxHost() end function utils.HostOsInfo.isLinuxHost() end

View File

@@ -15,8 +15,7 @@ This plugin provides some functionality.
You can describe it more here. You can describe it more here.
]], ]],
Dependencies = { Dependencies = {
{ Name = "Core", Version = "%{JS: Util.qtCreatorIdeVersion()}", Required = true }, { Name = "Lua", Version = "%{JS: Util.qtCreatorIdeVersion()}" },
{ Name = "Lua", Version = "%{JS: Util.qtCreatorIdeVersion()}", Required = true },
}, },
setup = function() setup = function()
require 'init'.setup() require 'init'.setup()

View File

@@ -9,7 +9,7 @@
"-tcs", "-tcs",
"-load", "-load",
"Lua", "Lua",
"-loadluaplugin", "-pluginpath",
"%\{ActiveProject:ProjectDirectory\}" "%\{ActiveProject:ProjectDirectory\}"
] ]
} }

View File

@@ -19,10 +19,6 @@
"key": "ProjectFile", "key": "ProjectFile",
"value": "%{ProjectDirectory}/.qtcreator/project.json" "value": "%{ProjectDirectory}/.qtcreator/project.json"
}, },
{
"key": "PluginNameLower",
"value": "%{JS: value('PluginName').toLowerCase()}"
},
{ {
"key": "PluginSpecFile", "key": "PluginSpecFile",
"value": "%{JS: Util.fileName(value('PluginName').toLowerCase(), Util.preferredSuffix('text/x-lua'))}" "value": "%{JS: Util.fileName(value('PluginName').toLowerCase(), Util.preferredSuffix('text/x-lua'))}"
@@ -147,14 +143,14 @@
}, },
{ {
"source": "init.lua.tpl", "source": "init.lua.tpl",
"target": "%{SrcFileName}" "target": "%{PluginName}/%{SrcFileName}"
}, },
{ {
"source": ".luarc.json" "source": ".luarc.json"
}, },
{ {
"source": "plugin.lua.tpl", "source": "plugin.lua.tpl",
"target": "%{PluginSpecFile}", "target": "%{PluginName}/%{PluginSpecFile}",
"openInEditor": true "openInEditor": true
} }
] ]

View File

@@ -14,9 +14,8 @@ This plugin provides the Lua Language Server.
It will try to install it if it is not found. It will try to install it if it is not found.
]], ]],
Dependencies = { Dependencies = {
{ Name = "Core", Version = "13.0.82", Required = true }, { Name = "Lua", Version = "14.0.0" },
{ Name = "Lua", Version = "13.0.82", Required = true }, { Name = "LuaLanguageClient", Version = "14.0.0" }
{ Name = "LuaLanguageClient", Version = "13.0.82", Required = true }
}, },
setup = function() setup = function()
require 'init'.setup() require 'init'.setup()

View File

@@ -13,8 +13,7 @@ return {
It has tests for (almost) all functionality exposed by the API. It has tests for (almost) all functionality exposed by the API.
]], ]],
Dependencies = { Dependencies = {
{ Name = "Core", Version = "13.0.82", Required = true }, { Name = "Lua", Version = "14.0.0" }
{ Name = "Lua", Version = "13.0.82", Required = true }
}, },
setup = function() require 'tests'.setup() end, setup = function() require 'tests'.setup() end,
printToOutputPane = true, printToOutputPane = true,

View File

@@ -75,6 +75,7 @@ using ProjectExplorer::ToolchainManager;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
using testing::Between;
namespace { namespace {
const char empty[]{""}; const char empty[]{""};
@@ -506,6 +507,7 @@ void McuSupportTest::init()
void McuSupportTest::cleanup() void McuSupportTest::cleanup()
{ {
QVERIFY(settingsMockPtr.get());
QVERIFY(testing::Mock::VerifyAndClearExpectations(settingsMockPtr.get())); QVERIFY(testing::Mock::VerifyAndClearExpectations(settingsMockPtr.get()));
QVERIFY(testing::Mock::VerifyAndClearExpectations(freeRtosPackage)); QVERIFY(testing::Mock::VerifyAndClearExpectations(freeRtosPackage));
QVERIFY(testing::Mock::VerifyAndClearExpectations(sdkPackage)); QVERIFY(testing::Mock::VerifyAndClearExpectations(sdkPackage));
@@ -854,7 +856,7 @@ void McuSupportTest::test_useFallbackPathForToolchainWhenPathFromSettingsIsNotAv
McuTargetDescription::Toolchain toolchainDescription{armGcc, {}, compilerDescription, {}}; McuTargetDescription::Toolchain toolchainDescription{armGcc, {}, compilerDescription, {}};
EXPECT_CALL(*settingsMockPtr, getPath(Key{armGccDirectorySetting}, _, FilePath{fallbackDir})) EXPECT_CALL(*settingsMockPtr, getPath(Key{armGccDirectorySetting}, _, FilePath{fallbackDir}))
.Times(2) .Times(Between(2,3))
.WillRepeatedly(Return(FilePath{fallbackDir})); .WillRepeatedly(Return(FilePath{fallbackDir}));
McuToolchainPackage *toolchain = targetFactory.createToolchain(toolchainDescription); McuToolchainPackage *toolchain = targetFactory.createToolchain(toolchainDescription);
@@ -1559,7 +1561,7 @@ void McuSupportTest::test_legacy_createThirdPartyPackage()
QFETCH(QString, detectionPath); QFETCH(QString, detectionPath);
EXPECT_CALL(*settingsMockPtr, getPath(Key{setting}, _, _)) EXPECT_CALL(*settingsMockPtr, getPath(Key{setting}, _, _))
.Times(2) .Times(Between(2,3))
.WillRepeatedly(Return(FilePath::fromUserInput(defaultPath))); .WillRepeatedly(Return(FilePath::fromUserInput(defaultPath)));
McuPackagePtr thirdPartyPackage{creator()}; McuPackagePtr thirdPartyPackage{creator()};
@@ -1644,7 +1646,7 @@ void McuSupportTest::test_createThirdPartyPackage()
.WillOnce(Return(FilePath::fromUserInput(defaultPath))); .WillOnce(Return(FilePath::fromUserInput(defaultPath)));
EXPECT_CALL(*settingsMockPtr, getPath(Key{setting}, QSettings::UserScope, _)) EXPECT_CALL(*settingsMockPtr, getPath(Key{setting}, QSettings::UserScope, _))
.Times(testing::AtMost(1)) .Times(testing::AtMost(2))
.WillOnce(Return(FilePath::fromUserInput(path))); .WillOnce(Return(FilePath::fromUserInput(path)));
auto [targets, packages] = targetFactory.createTargets(targetDescription, sdkPackagePtr); auto [targets, packages] = targetFactory.createTargets(targetDescription, sdkPackagePtr);
@@ -1668,7 +1670,7 @@ void McuSupportTest::test_createThirdPartyPackage()
void McuSupportTest::test_legacy_createCypressProgrammer3rdPartyPackage() void McuSupportTest::test_legacy_createCypressProgrammer3rdPartyPackage()
{ {
EXPECT_CALL(*settingsMockPtr, getPath(Key{cypressProgrammerSetting}, _, _)) EXPECT_CALL(*settingsMockPtr, getPath(Key{cypressProgrammerSetting}, _, _))
.Times(2) .Times(Between(2,3))
.WillRepeatedly(Return(FilePath::fromUserInput(defaultToolPath))); .WillRepeatedly(Return(FilePath::fromUserInput(defaultToolPath)));
McuPackagePtr thirdPartyPackage{Legacy::createCypressProgrammerPackage(settingsMockPtr)}; McuPackagePtr thirdPartyPackage{Legacy::createCypressProgrammerPackage(settingsMockPtr)};
@@ -1692,7 +1694,7 @@ void McuSupportTest::test_createJLink3rdPartyPackage()
.WillOnce(Return(FilePath::fromUserInput(jlinkPath))); .WillOnce(Return(FilePath::fromUserInput(jlinkPath)));
EXPECT_CALL(*settingsMockPtr, getPath(Key{jlinkSetting}, QSettings::UserScope, _)) EXPECT_CALL(*settingsMockPtr, getPath(Key{jlinkSetting}, QSettings::UserScope, _))
.Times(testing::AtMost(1)) .Times(testing::AtMost(2))
.WillOnce(Return(FilePath::fromUserInput(jlinkPath))); .WillOnce(Return(FilePath::fromUserInput(jlinkPath)));
auto [targets, packages] = targetFactory.createTargets(targetDescription, sdkPackagePtr); auto [targets, packages] = targetFactory.createTargets(targetDescription, sdkPackagePtr);

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Some files were not shown because too many files have changed in this diff Show More