Find your way around the code - musescore/MuseScore GitHub Wiki

Summary

Once you've successfully compiled MuseScore and found a task or issue you want to tackle, the next step is to find the relevant part of the code.

It's a good idea to search the source code for terms related to the issue. If the issue has screenshots that show UI text, try searching for that text; there's a good chance it's defined near the code you need to edit.

GitHub search

Note

GitHub only searches the default branch: master. To search other branches (e.g. 3.x) use offline search instead.

The search feature here on GitHub is a good place to start.

Example GitHub query Searches for files that...
note input Have the word "note" and the word "input" in the content or in the path.
"note input" Have the exact string "note input" (without quotes) in the content or in the path.
content:/note ?(input|entry)/ Contain the exact string "note input", "noteinput", "note entry", or "noteentry".
content:/"note-[a-g]"/ Contain the exact string "note-a", "note-b", ... or "note-g" (with quotes this time).
path:score language:cpp Are C++ files (including headers) with "score" somewhere in the path.
path:score path:.cpp Have "score" and ".cpp" somewhere in the path.
content:score NOT path:/\.cpp$/ Contain "score" but the path does not end in ".cpp".
symbol:rest Use "rest" in the name of a code symbol (i.e. a variable, function, or class).

See GitHub search syntax for more details, or use advanced search. Remember to restrict it to repo:musescore/MuseScore.

ripgrep

The command line utility ripgrep (rg) is like Unix grep but faster and more powerful. It enables you to search for strings and regular expressions in lots of files very quickly. By default, ripgrep ignores binary files and files that are ignored by Git, such as those in the build folder.

Use your package manager to install ripgrep. Once installed, here's an example of how to use it:

rg -i "note.?input"

This performs a case-insensitive search for the regular expression note.?input across all files in the repository.

It would match occurrences of:

  • note input
  • Note Input
  • noteInput
  • NOTE_INPUT
  • note-input
  • etc.

Here are some useful arguments for ripgrep. See rg --help or man rg for more.

Argumentโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ Action
-F,
--fixed-strings
Search for a fixed string instead of a regular expression (e.g. -F "Note input").
-i,
--ignore-case
Perform a case-insensitive search. (Without -i, searches are case-sensitive by default.)
-C[num],
--context=[num]
Show this many neighboring lines before (-B[num]), after (-A[num]), or both before and after (-C[num]) each matching line.
-l,
--files-with-matches
Just list matching files; don't show the matching lines.
--files-without-matches List files that don't contain any matching lines. Inverse of -l.
-v,
--invert-match
Show lines that do not match the given pattern instead of lines that do. (When combined with -l, this lists files that contain at least one non-matching line, which normally overlaps with standard -l output.)
-t[type],
--type=[type]
Only search files of this type (e.g. -tcpp includes all .cpp, .cxx, .h, .hpp and .hxx files).
[path...] Only search the specified file(s) or directory tree(s) (e.g. src/).

IDEs

IDEs provide shortcuts to navigate code and find references to symbols (variables, functions, classes, etc.).

Qt Creator

Switch between source and header files

Press F4 in any .cpp file to be taken to the corresponding .h file, if there is one, and vice versa.

Follow symbol under cursor

Click on the name of any symbol and press F2 to be taken to where the symbol is declared/defined.

Find references to symbol under cursor

Right-click on the name of any symbol and choose this option to see a list of other places the symbol is used.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ