مرجع نحو
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه اطلاعات دقیقی در مورد فیلترهای پشتیبانی شده، عملگرها، گزینه های نحوی و میانبرهای صفحه کلید برای جستجوی کد ارائه می دهد.
فیلترهای پشتیبانی شده
جدول زیر فیلترهایی را که می توانید هنگام جستجوی کد استفاده کنید فهرست می کند.
فیلتر کنید | گزینه های دیگر | توضیحات | مثال |
---|
case:yes | case:y | مورد جستجو را حساس کنید. به طور پیش فرض، جستجوها به حروف بزرگ و کوچک حساس نیستند.
اگر چندین عبارت جستجو را گروه بندی می کنید، این فیلتر توسط همه گروه های فرزند به ارث می رسد. | case:yes Hello World |
class: | | نام کلاس را جستجو کنید | class:MainClass |
comment: | | جستجو در نظرات | comment:bug |
content: | | فقط برای محتویات فایل جستجو کنید. این شامل نام فایل ها نمی شود. | content:hello |
file: | filepath: path: f: | فایل را بر اساس نام یا مسیر جستجو کنید. | file:test.js |
function: | func: | نام تابع را جستجو کنید. | function:print |
lang: | language: | نتایج را با استفاده از یک زبان خاص جستجو کنید. | lang:java test |
pcre:yes | | از عبارات منظم سازگار پرل استفاده کنید.
برای جستجو در خطوط مفید است. | pcre:yes @Provides\s+double |
symbol: | | یک نماد خاص را جستجو کنید. | symbol:immutable |
usage: | | جستجو بدون در نظر گرفتن نظرات و حروف الفبای رشته. | usage:map |
گزینه های زبان
جدول زیر زبان های برنامه نویسی رایج مورد استفاده را که توسط lang:
filter پشتیبانی می شوند، فهرست می کند. در صورت لزوم، می توان از نام مستعار برای مقدار استفاده کرد.
زبان | lang: ارزش | نام مستعار |
---|
C++ | c++ | cpp ، cc ، cxx |
سی | c | |
جاوا | java | |
کاتلین | kotlin | kt ، kts |
پایتون | python | py |
جاوا اسکریپت | javascript | js |
برو | go | golang |
JSON | json | |
HTML | html | angular |
Objective-C++ | objectivec++ | |
هدف-C | objectivec | objc |
مارک داون | markdown | md |
اپل اسکریپت | applescript | |
سی شارپ | c# | csharp |
CSS | css | |
CSV | csv | |
حلقه کردن | curl | |
دارت | dart | |
جانگو | django | |
JSP | jsp | |
پرل | perl | |
PHP | php | |
پاورشل | powershell | |
روبی | ruby | |
زنگ زدگی | rust | rs |
پوسته | shell | bash ، sh |
SHTML | shtml | |
SQL | sql | |
سویفت | swift | |
Tcl | tcl | |
XML | xml | |
XSLT | xslt | |
YAML | yaml | |
اپراتورهای پشتیبانی شده
جدول زیر عملگرهایی را که می توانید هنگام جستجوی کد استفاده کنید، فهرست می کند.
گزینه های نحو اضافی
گزینه های نحو اضافی زیر برای جستجوی کد پشتیبانی می شوند.
گزینه | توضیحات |
---|
( search_expression ) | چند اصطلاح را با هم گروه بندی می کند. برای اطلاعات بیشتر به گروه بندی عبارات جستجو مراجعه کنید. |
- | عبارت را از نتایج جستجو حذف می کند. |
\ | فرار از شخصیت های خاص مانند . ، \ یا ( . |
" search_expression " | جستجوی تحت اللفظی را بدون تفسیر عبارت جستجو به عنوان یک عبارت منظم انجام دهید. |
میانبرهای صفحه کلید پشتیبانی شده
برای دیدن میانبرهای صفحه کلید موجود در جستجوی کد، تایپ کنید ?
.
جدول زیر میانبرهای صفحه کلیدی را که می توانید هنگام جستجوی کد استفاده کنید، فهرست می کند.
کلید(های) | اقدام |
---|
ساعت | نمایش تاریخچه ویرایش فایل |
q | پانل پایین را تغییر دهید. |
ب | نمایش یا پنهان کردن لایه سرزنش |
f | نوار یافتن را نشان دهید. |
/ | تمرکز را به کادر جستجو تغییر دهید. |
o | تغییر فوکوس به مرورگر طرح کلی. |
تی | تغییر تمرکز به درخت دایرکتوری. |
ل | منوی کشویی لینک ها را باز می کند. |
lp | مسیر فایل را در منوی کشویی لینک ها کپی می کند. |
lh | پیوند را به نسخه HEAD فایل در منوی کشویی پیوندها کپی می کند. |
lr | پیوند را به نسخه فعلی فایل و خط فعلی در منوی کشویی پیوندها کپی می کند. |
. | وقتی در کادر جستجو هستید، کد یا فایلها را در فهرست فعلی جستجو کنید. |
j | نتیجه بعدی را در نتایج جستجو انتخاب کنید. |
ک | نتیجه قبلی را در نتایج جستجو انتخاب کنید. |
x | نشان دادن ارجاع متقابل برای نمادها. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-28 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-28 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eCode Search allows you to search for code using filters like \u003ccode\u003elang:\u003c/code\u003e, \u003ccode\u003efile:\u003c/code\u003e, and \u003ccode\u003eclass:\u003c/code\u003e to refine your results by language, filename, or class name respectively.\u003c/p\u003e\n"],["\u003cp\u003eYou can use operators like \u003ccode\u003eAND\u003c/code\u003e and \u003ccode\u003eOR\u003c/code\u003e to combine search terms, along with additional syntax options for grouping, excluding, and escaping characters within your queries.\u003c/p\u003e\n"],["\u003cp\u003eCode Search supports keyboard shortcuts for actions such as showing file history (h), toggling the bottom panel (q), and navigating search results (j/k).\u003c/p\u003e\n"],["\u003cp\u003eA wide variety of common programming languages are supported by Code Search, including but not limited to: Python, Java, JavaScript, C++, Go, and more, which can be specified using the \u003ccode\u003elang:\u003c/code\u003e filter and their respective values or aliases.\u003c/p\u003e\n"]]],[],null,["This page provides detailed information on the supported filters, operators,\nsyntax options, and keyboard shortcuts for Code Search.\n\nSupported filters\n\nThe following table lists the filters you can use when searching code.\n\n| Filter | Other options | Description | Example |\n|-------------|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|\n| `case:yes` | `case:y` | Make the search case sensitive. By default, searches are not case sensitive. If you are grouping multiple search terms, this filter is inherited by all child groups. | `case:yes Hello World` |\n| `class:` | | Search for a class name. | `class:MainClass` |\n| `comment:` | | Search within comments. | `comment:bug` |\n| `content:` | | Search only for file contents. This excludes filenames. | `content:hello` |\n| `file:` | `filepath:` `path:` `f:` | Search for a file by filename or path. | `file:test.js` |\n| `function:` | `func:` | Search for a function name. | `function:print` |\n| `lang:` | `language:` | Search for results by using a specific language. | `lang:java test` |\n| `pcre:yes` | | Use Perl compatible regular expressions. Useful for searching across lines. | `pcre:yes @Provides\\s+double` |\n| `symbol:` | | Search for a specific symbol. | `symbol:immutable` |\n| `usage:` | | Search while excluding comments and string literals. | `usage:map` |\n\nlang options\n\nThe table below lists the commonly used programming languages supported by the\n`lang:` filter. Where applicable, an alias can be used for the value.\n\n| Language | `lang:` value | Aliases |\n|---------------|----------------|--------------------|\n| C++ | `c++` | `cpp`, `cc`, `cxx` |\n| C | `c` | |\n| Java | `java` | |\n| Kotlin | `kotlin` | `kt`, `kts` |\n| Python | `python` | `py` |\n| JavaScript | `javascript` | `js` |\n| Go | `go` | `golang` |\n| JSON | `json` | |\n| HTML | `html` | `angular` |\n| Objective-C++ | `objectivec++` | |\n| Objective-C | `objectivec` | `objc` |\n| Markdown | `markdown` | `md` |\n| AppleScript | `applescript` | |\n| C# | `c#` | `csharp` |\n| CSS | `css` | |\n| CSV | `csv` | |\n| curl | `curl` | |\n| Dart | `dart` | |\n| Django | `django` | |\n| JSP | `jsp` | |\n| Perl | `perl` | |\n| PHP | `php` | |\n| PowerShell | `powershell` | |\n| Ruby | `ruby` | |\n| Rust | `rust` | `rs` |\n| shell | `shell` | `bash`, `sh` |\n| SHTML | `shtml` | |\n| SQL | `sql` | |\n| Swift | `swift` | |\n| Tcl | `tcl` | |\n| XML | `xml` | |\n| XSLT | `xslt` | |\n| YAML | `yaml` | |\n\nSupported operators\n\nThe following table lists the operators you can use when searching code.\n\n| Operator | Description |\n|----------|--------------------------------------------------------------------------------------------------------------|\n| `AND` | Logical \\`AND\\` operator. See [Using the AND operator](/code-search/user/and-operator) for more information. |\n| `OR` | Logical \\`OR\\` operator. See [Using the OR operator](/code-search/user/or-operator) for more information. |\n\nAdditional syntax options\n\nThe following additional syntax options are supported for searching code.\n\n| Option | Description |\n|-----------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| (\u003cvar translate=\"no\"\u003esearch_expression\u003c/var\u003e) | Groups multiple terms together. See [Grouping search terms](/code-search/user/group-terms) for more information. |\n| `-` | Excludes the term from search results. |\n| `\\` | Escapes special characters such as `.`, `\\`, or `(`. |\n| \"\u003cvar translate=\"no\"\u003esearch_expression\u003c/var\u003e\" | Perform a literal search without interpreting the search query as a regular expression. |\n\nSupported keyboard shortcuts\n\nTo see the keyboard shortcuts available in Code Search, type `?`.\n\nThe following table lists the keyboard shortcuts you can use when searching\ncode.\n\n| Key(s) | Action |\n|--------|-------------------------------------------------------------------------------------------------|\n| h | Show the file's revision history. |\n| q | Toggle the bottom panel. |\n| b | Show or hide the blame layer. |\n| f | Show the find bar. |\n| / | Change focus to the search box. |\n| o | Change focus to the outline browser. |\n| t | Change focus to the directory tree. |\n| l | Opens the Links drop-down. |\n| lp | Copies the file path in the Links drop-down. |\n| lh | Copies the link to the HEAD version of the file in the Links drop-down. |\n| lr | Copies the link to the current version of the file and the current line in the Links drop-down. |\n| . | While in the search box, search for code or files in the current directory. |\n| j | Select the next result in the search results. |\n| k | Select the previous result in the search results. |\n| x | Show cross references for symbols. |"]]