Finds occurrences of an identifier by name in a file
Given a file path and identifier name, returns:
Without position: All matching identifiers in the file
With position: The exact identifier with that name at that position, or 3 closest identifiers with that name
Example finding all occurrences of “user_name”:
let user_name = "John"; // First occurrenceprintln!("{}", user_name); // Second occurrence
When a position is provided, it searches for an exact match at that location.
If no exact match exists, returns the 3 identifiers closest to the position
based on line and character distance, prioritizing lines.
POST
/
symbol
/
find-identifier
Finds occurrences of an identifier by name in a file
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Lsproxy Docs","colors":{"primary":"#0D9373","light":"#2DB0B3","dark":"#0D9373"},"favicon":"logo/agentic_logo.png","logo":{"light":"https://mintcdn.com/agenticlabs-2964319e/iD3j-Tz9pOfvLayG/logo/agentic_logo.png?fit=max\u0026auto=format\u0026n=iD3j-Tz9pOfvLayG\u0026q=85\u0026s=2aa1671e6e2263e42bd436462418914a","dark":"https://mintcdn.com/agenticlabs-2964319e/iD3j-Tz9pOfvLayG/logo/agentic_logo.png?fit=max\u0026auto=format\u0026n=iD3j-Tz9pOfvLayG\u0026q=85\u0026s=2aa1671e6e2263e42bd436462418914a","href":"https://lsproxy.dev"},"api":{"playground":{"display":"simple"}},"navbar":{"primary":{"type":"github","href":"https://github.com/agentic-labs/lsproxy"}},"footer":{"socials":{"x":"https://x.com/agentic_labs","linkedin":"https://www.linkedin.com/company/agentic-labs"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"agenticlabs-2964319e","hasAudioNarration":false,"actualSubdomain":"agenticlabs-2964319e","customDomains":["docs.lsproxy.dev"],"gitSource":{"type":"github","owner":"robmck1995","repo":"mintlify-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae921c952a14f3f52ff7c91:success","clientVersion":"0.0.4102","searchFilterCounts":[{"language":"default","tag":"API Reference","count":8},{"language":"default","tag":"symbol","count":5},{"language":"default","tag":"Get Started","count":4},{"language":"default","tag":"workspace","count":2},{"language":"default","tag":"system","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file","slug":"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file","pageMetadata":{"title":"Finds occurrences of an identifier by name in a file","description":"Given a file path and identifier name, returns:\n- Without position: All matching identifiers in the file\n- With position: The exact identifier with that name at that position, or 3 closest identifiers with that name\n\nExample finding all occurrences of \"user_name\":\n```\nlet user_name = \"John\"; // First occurrence\nprintln!(\"{}\", user_name); // Second occurrence\n```\n\nWhen a position is provided, it searches for an exact match at that location.\nIf no exact match exists, returns the 3 identifiers closest to the position\nbased on line and character distance, prioritizing lines.","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-identifier","href":"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n li: \"li\",\n p: \"p\",\n pre: \"pre\",\n span: \"span\",\n ul: \"ul\",\n ..._provideComponents(),\n ...props.components\n }, {CodeBlock} = _components;\n if (!CodeBlock) _missingMdxReference(\"CodeBlock\", true);\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Given a file path and identifier name, returns:\"\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: \"Without position: All matching identifiers in the file\"\n }), \"\\n\", _jsx(_components.li, {\n children: \"With position: The exact identifier with that name at that position, or 3 closest identifiers with that name\"\n }), \"\\n\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Example finding all occurrences of “user_name”:\"\n }), \"\\n\", _jsx(CodeBlock, {\n numberOfLines: \"3\",\n language: \"text\",\n children: _jsx(_components.pre, {\n className: \"shiki shiki-themes github-light-default dark-plus\",\n style: {\n backgroundColor: \"#ffffff\",\n \"--shiki-dark-bg\": \"#0B0C0E\",\n color: \"#1f2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n language: \"text\",\n children: _jsxs(_components.code, {\n language: \"text\",\n numberOfLines: \"3\",\n children: [_jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n children: \"let user_name = \\\"John\\\"; // First occurrence\"\n })\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n children: \"println!(\\\"{}\\\", user_name); // Second occurrence\"\n })\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {})\n })]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"When a position is provided, it searches for an exact match at that location.\\nIf no exact match exists, returns the 3 identifiers closest to the position\\nbased on line and character distance, prioritizing lines.\"\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\nfunction _missingMdxReference(id, component) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\");\n}\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Finds occurrences of an identifier by name in a file","description":"Given a file path and identifier name, returns:\n- Without position: All matching identifiers in the file\n- With position: The exact identifier with that name at that position, or 3 closest identifiers with that name\n\nExample finding all occurrences of \"user_name\":\n```\nlet user_name = \"John\"; // First occurrence\nprintln!(\"{}\", user_name); // Second occurrence\n```\n\nWhen a position is provided, it searches for an exact match at that location.\nIf no exact match exists, returns the 3 identifiers closest to the position\nbased on line and character distance, prioritizing lines.","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-identifier","href":"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["symbol"],"summary":"Finds occurrences of an identifier by name in a file","description":"Given a file path and identifier name, returns:\n- Without position: All matching identifiers in the file\n- With position: The exact identifier with that name at that position, or 3 closest identifiers with that name\n\nExample finding all occurrences of \"user_name\":\n```\nlet user_name = \"John\"; // First occurrence\nprintln!(\"{}\", user_name); // Second occurrence\n```\n\nWhen a position is provided, it searches for an exact match at that location.\nIf no exact match exists, returns the 3 identifiers closest to the position\nbased on line and character distance, prioritizing lines.","operationId":"find_identifier","requestBody":"8cb19e49-636d-4d1e-b495-7ac0916fc5e9","responses":{"200":"0791b676-b18f-48e8-a6a8-d9f17973e160","400":"a53082a2-a422-4106-995f-c056e0d56c6f","500":"43a26b49-4f87-42d1-8c7b-bffebb9b4bae"},"method":"post","type":"path","servers":["89e32637-1c15-409a-9b63-72b5b6da9a60"],"security":["d5181418-c172-4f34-ac26-eb0ac96a7cb4"],"path":"/symbol/find-identifier","baseUrlOptions":["http://localhost:4444/v1"],"title":"Finds occurrences of an identifier by name in a file","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","path"],"properties":{"name":{"type":"string","description":"The name of the identifier to search for.","example":"User","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"path":{"type":"string","description":"The path to the file to search for identifiers.","example":"src/main.py","isRequired":true,"uniqueKey":"path","typeLabel":"string"},"position":{"oneOf":[{"type":"null","uniqueKey":"position.oneOf.0","typeLabel":"null"},{"type":"object","description":"The position hint to search for identifiers. If not provided.","required":["line","character"],"properties":{"character":{"type":"integer","format":"int32","description":"0-indexed character index within the line.","example":5,"minimum":0,"isRequired":true,"uniqueKey":"position.oneOf.1.character","typeLabel":"integer\u003cint32>"},"line":{"type":"integer","format":"int32","description":"0-indexed line number.","example":10,"minimum":0,"isRequired":true,"uniqueKey":"position.oneOf.1.line","typeLabel":"integer\u003cint32>"}},"uniqueKey":"position.oneOf.1","typeLabel":"object"}],"uniqueKey":"position","typeLabel":"null | object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"name":"User","path":"src/main.py","position":{"character":5,"line":10}}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"0791b676-b18f-48e8-a6a8-d9f17973e160":{"description":"Identifier retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["identifiers"],"properties":{"identifiers":{"type":"array","items":{"type":"object","required":["name","file_range"],"properties":{"file_range":{"type":"object","description":"A range within a specific file, defined by start and end positions","required":["path","range"],"properties":{"path":{"type":"string","description":"The path to the file.","example":"src/main.py","isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.path","typeLabel":"string"},"range":{"type":"object","required":["start","end"],"properties":{"end":{"type":"object","description":"The end position of the range.","required":["line","character"],"properties":{"character":{"type":"integer","format":"int32","description":"0-indexed character index within the line.","example":5,"minimum":0,"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.end.character","typeLabel":"integer\u003cint32>"},"line":{"type":"integer","format":"int32","description":"0-indexed line number.","example":10,"minimum":0,"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.end.line","typeLabel":"integer\u003cint32>"}},"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.end","typeLabel":"object"},"start":{"type":"object","description":"The start position of the range.","required":["line","character"],"properties":{"character":{"type":"integer","format":"int32","description":"0-indexed character index within the line.","example":5,"minimum":0,"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.start.character","typeLabel":"integer\u003cint32>"},"line":{"type":"integer","format":"int32","description":"0-indexed line number.","example":10,"minimum":0,"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.start.line","typeLabel":"integer\u003cint32>"}},"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range.start","typeLabel":"object"}},"description":"The range within the file","isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range.range","typeLabel":"object"}},"isRequired":true,"uniqueKey":"identifiers.items.[INDEX].file_range","typeLabel":"object"},"name":{"type":"string","isRequired":true,"uniqueKey":"identifiers.items.[INDEX].name","typeLabel":"string"},"kind":{"oneOf":[{"type":"string","uniqueKey":"identifiers.items.[INDEX].kind.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"identifiers.items.[INDEX].kind.oneOf.1","typeLabel":"null"}],"uniqueKey":"identifiers.items.[INDEX].kind","typeLabel":"string | null"}},"uniqueKey":"identifiers.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"identifiers","typeLabel":"object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"identifiers":[{"file_range":{"path":"src/main.py","range":{"end":{"character":5,"line":10},"start":{"character":5,"line":10}}},"name":"\u003cstring>","kind":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"},"a53082a2-a422-4106-995f-c056e0d56c6f":{"description":"Bad request","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"43a26b49-4f87-42d1-8c7b-bffebb9b4bae":{"description":"Internal server error","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}}},"security":{"d5181418-c172-4f34-ac26-eb0ac96a7cb4":{"bearer_auth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[]}}},"servers":{"89e32637-1c15-409a-9b63-72b5b6da9a60":{"url":"http://localhost:4444/v1","description":"API server v1"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearer_auth","name":"Authorization"}],"title":"bearer_auth"}]},"originalFileLocation":"openapi.json"},"subdomain":"agenticlabs-2964319e","siteName":"Lsproxy Docs","title":"Finds occurrences of an identifier by name in a file - Lsproxy Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T03:49:51.391Z","originalFileLocation":"api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Given a file path and identifier name, returns: - Without position: All matching identifiers in the file - With position: The exact identifier with that name at that position, or 3 closest identifiers with that name Example finding all occurrences of \u0026quot;user_name\u0026quot;: let user_name = \u0026quot;John\u0026quot;; // First occurrence println!(\u0026quot;{}\u0026quot;, user_name); // Second occurrence When a position is provided, it searches for an exact match at that location. If no exact match exists, returns the 3 identifiers closest to the position based on line and character distance, prioritizing lines.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Lsproxy Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Finds occurrences of an identifier by name in a file - Lsproxy Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Given a file path and identifier name, returns: - Without position: All matching identifiers in the file - With position: The exact identifier with that name at that position, or 3 closest identifiers with that name Example finding all occurrences of \u0026quot;user_name\u0026quot;: let user_name = \u0026quot;John\u0026quot;; // First occurrence println!(\u0026quot;{}\u0026quot;, user_name); // Second occurrence When a position is provided, it searches for an exact match at that location. If no exact match exists, returns the 3 identifiers closest to the position based on line and character distance, prioritizing lines.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Lsproxy Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://agenticlabs-2964319e.mintlify.site/_mintlify/api/og/v2?division=symbol\u0026amp;title=Finds+occurrences+of+an+identifier+by+name+in+a+file\u0026amp;description=Given+a+file+path+and+identifier+name%2C+returns%3A%0A-+Without+position%3A+All+matching+identifiers+in+the+file%0A-+With+position%3A+The+exact+identifier+with+that+name+at\u0026amp;theme=806041730a4e5f2e1bd8b491\u0026amp;signature=3e8ebcb79d3a74506a28bafa74c442548c38a7a764a1ce8c25088facda10bd48\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Finds occurrences of an identifier by name in a file - Lsproxy Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Given a file path and identifier name, returns: - Without position: All matching identifiers in the file - With position: The exact identifier with that name at that position, or 3 closest identifiers with that name Example finding all occurrences of \u0026quot;user_name\u0026quot;: let user_name = \u0026quot;John\u0026quot;; // First occurrence println!(\u0026quot;{}\u0026quot;, user_name); // Second occurrence When a position is provided, it searches for an exact match at that location. If no exact match exists, returns the 3 identifiers closest to the position based on line and character distance, prioritizing lines.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://agenticlabs-2964319e.mintlify.site/_mintlify/api/og/v2?division=symbol\u0026amp;title=Finds+occurrences+of+an+identifier+by+name+in+a+file\u0026amp;description=Given+a+file+path+and+identifier+name%2C+returns%3A%0A-+Without+position%3A+All+matching+identifiers+in+the+file%0A-+With+position%3A+The+exact+identifier+with+that+name+at\u0026amp;theme=806041730a4e5f2e1bd8b491\u0026amp;signature=3e8ebcb79d3a74506a28bafa74c442548c38a7a764a1ce8c25088facda10bd48\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/agenticlabs-2964319e/KOUEMwyUBLnsf-_2/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Lsproxy Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lsproxy.dev/#organization\",\"name\":\"Lsproxy Docs\",\"url\":\"https://docs.lsproxy.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/agenticlabs-2964319e/iD3j-Tz9pOfvLayG/logo/agentic_logo.png?fit=max\u0026auto=format\u0026n=iD3j-Tz9pOfvLayG\u0026q=85\u0026s=2aa1671e6e2263e42bd436462418914a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lsproxy.dev#website\",\"name\":\"Lsproxy Docs\",\"url\":\"https://docs.lsproxy.dev\",\"publisher\":{\"@id\":\"https://docs.lsproxy.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file#webpage\",\"url\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file\",\"name\":\"Finds occurrences of an identifier by name in a file\",\"description\":\"Given a file path and identifier name, returns: - Without position: All matching identifiers in the file - With position: The exact identifier with that name at that position, or 3 closest identifiers with that name Example finding all occurrences of \\\"user_name\\\": let user_name = \\\"John\\\"; // First occurrence println!(\\\"{}\\\", user_name); // Second occurrence When a position is provided, it searches for an exact match at that location. If no exact match exists, returns the 3 identifiers closest to the position based on line and character distance, prioritizing lines.\",\"dateModified\":\"2026-01-07T03:49:51.391Z\",\"isPartOf\":{\"@id\":\"https://docs.lsproxy.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"symbol\",\"item\":\"https://docs.lsproxy.dev/api-reference/symbol/get-symbols-in-a-specific-file-uses-ast-grep\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Finds occurrences of an identifier by name in a file\",\"item\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file#apireference\",\"headline\":\"Finds occurrences of an identifier by name in a file\",\"name\":\"Finds occurrences of an identifier by name in a file\",\"description\":\"Given a file path and identifier name, returns: - Without position: All matching identifiers in the file - With position: The exact identifier with that name at that position, or 3 closest identifiers with that name Example finding all occurrences of \\\"user_name\\\": let user_name = \\\"John\\\"; // First occurrence println!(\\\"{}\\\", user_name); // Second occurrence When a position is provided, it searches for an exact match at that location. If no exact match exists, returns the 3 identifiers closest to the position based on line and character distance, prioritizing lines.\",\"url\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lsproxy.dev/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file#webpage\"},\"dateModified\":\"2026-01-07T03:49:51.391Z\",\"publisher\":{\"@id\":\"https://docs.lsproxy.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lsproxy.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Lsproxy Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Lsproxy Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file.md","siteName":"Lsproxy Docs","nav":{"global":null,"tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/get-started/introduction"}]},{"tab":"API Reference","groups":[{"group":"symbol","pages":[{"title":"Get symbols in a specific file (uses ast-grep)","deprecated":null,"version":null,"openapi":"openapi.json get /symbol/definitions-in-file","href":"/api-reference/symbol/get-symbols-in-a-specific-file-uses-ast-grep"},{"title":"Get the definition of a symbol at a specific position in a file","description":"Returns the location of the definition for the symbol at the given position.\n\nThe input position should point inside the symbol's identifier, e.g.\n\nThe returned position points to the identifier of the symbol, and the file_path from workspace root\n\ne.g. for the definition of `User` on line 5 of `src/main.py` with the code:\n```\n0: class User:\noutput___^\n1: def __init__(self, name, age):\n2: self.name = name\n3: self.age = age\n4:\n5: user = User(\"John\", 30)\ninput_____^^^^\n```","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-definition","href":"/api-reference/symbol/get-the-definition-of-a-symbol-at-a-specific-position-in-a-file"},{"title":"Finds occurrences of an identifier by name in a file","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-identifier","href":"/api-reference/symbol/finds-occurrences-of-an-identifier-by-name-in-a-file"},{"title":"Find all symbols that are referenced from a given symbol's definition","description":"The input position must point to a symbol (e.g. function name, class name, variable name).\nReturns all symbols referenced within that symbol's implementation, categorized into:\n- Workspace symbols (with their definitions)\n- External symbols (built-in functions like 'len', 'print' or from external libraries)\n- Symbols that couldn't be found\n\ne.g. for a function definition in `main.py`:\n```python\n@log_execution_time # Reference to decorator\ndef process_user(): # \u003c-- Input position here\n user = User() # Reference to User class\n print(\"Done\") # Reference to built-in function\n```\nThis would return:\n- Workspace symbols: [\n log_execution_time (with definition from decorators.py),\n User (with definition from models.py)\n ]\n- External symbols: print (Python built-in)","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-referenced-symbols","href":"/api-reference/symbol/find-all-symbols-that-are-referenced-from-a-given-symbols-definition"},{"title":"Find all references to a symbol","deprecated":null,"version":null,"openapi":"openapi.json post /symbol/find-references","href":"/api-reference/symbol/find-all-references-to-a-symbol"}]},{"group":"system","pages":[{"title":"Get health status of the LSP proxy service","deprecated":null,"version":null,"openapi":"openapi.json get /system/health","href":"/api-reference/system/get-health-status-of-the-lsp-proxy-service"}]},{"group":"workspace","pages":[{"title":"Get a list of all files in the workspace","deprecated":null,"version":null,"openapi":"openapi.json get /workspace/list-files","href":"/api-reference/workspace/get-a-list-of-all-files-in-the-workspace"},{"title":"Read source code from a file in the workspace","deprecated":null,"version":null,"openapi":"openapi.json post /workspace/read-source-code","href":"/api-reference/workspace/read-source-code-from-a-file-in-the-workspace"}]}]}]},"basePath":"","title":"Finds occurrences of an identifier by name in a file - Lsproxy Docs","buildId":"dpl_596ePT575z4qnAFksq1biRW97aLY","deploymentId":"dpl_596ePT575z4qnAFksq1biRW97aLY","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-C9Wu0MeN.js","utils-jWgu-6Qf.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DBD8f9qn.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-BGuX1ui5.js","snippetPresets-Evy63nQB.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-BQHO1lnV.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-B6C8m-t_.js","shallow-BG4cT0fH.js","getApiPlaygroundDisplay-CgEPrE-D.js","CodeSnippet-CU8JyZ9N.js","CodeSnippets-BnxHU32T.js","Page-D6S0Yh6q.js","getPastedJson-CwiYOonh.js","icon-DYDpWmDf.js","MethodPill-C-J-l7_c.js","DuplicateIcon-B6ARwg9w.js","createIcon-Dsv4MtDq.js","DynamicMarkdown-CtasenyM.js","SectionHeading-YNcgYwjB.js","axios-vUo_bRtp.js","Markdown-CwLx6PAg.js","clsx-C3kuh_dz.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CmKHfscc.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-U3mI6Ljh.js"]}