|
41 | 41 | import com.intellij.psi.util.PsiTreeUtil; |
42 | 42 | import com.intellij.util.Consumer; |
43 | 43 | import com.intellij.util.ThreeState; |
| 44 | +import com.intellij.util.containers.ContainerUtil; |
44 | 45 | import com.intellij.xdebugger.XDebugSession; |
45 | 46 | import com.intellij.xdebugger.XDebuggerUtil; |
46 | 47 | import com.intellij.xdebugger.XSourcePosition; |
@@ -223,21 +224,26 @@ public boolean canNavigateToSource() { |
223 | 224 |
|
224 | 225 | @Override |
225 | 226 | public boolean canNavigateToTypeSource() { |
226 | | - return myVariable.isStructure() && getProject() != null; |
| 227 | + return (myVariable.isStructure() || myVariable.isPtr()) && getProject() != null; |
227 | 228 | } |
228 | 229 |
|
229 | 230 | @Override |
230 | 231 | public void computeTypeSourcePosition(@NotNull XNavigatable navigatable) { |
231 | | - if (!myVariable.isStructure()) return; |
| 232 | + boolean isStructure = myVariable.isStructure(); |
| 233 | + boolean isPtr = myVariable.isPtr(); |
| 234 | + if (!isStructure && !isPtr) return; |
232 | 235 | Project project = getProject(); |
233 | 236 | if (project == null) return; |
234 | | - String fqn = myVariable.type; |
| 237 | + String dlvType = myVariable.type; |
| 238 | + String fqn = isPtr ? dlvType.replaceFirst("\\*struct ", "") : dlvType; |
235 | 239 | List<String> split = StringUtil.split(fqn, "."); |
236 | | - if (split.size() == 2) { |
237 | | - String name = split.get(1); |
| 240 | + boolean noFqn = split.size() == 1; |
| 241 | + if (split.size() == 2 || noFqn) { |
| 242 | + String name = ContainerUtil.getLastItem(split); |
| 243 | + assert name != null; |
238 | 244 | Collection<GoTypeSpec> types = GoTypesIndex.find(name, project, GlobalSearchScope.allScope(project)); |
239 | 245 | for (GoTypeSpec type : types) { |
240 | | - if (Comparing.equal(fqn, type.getQualifiedName())) { |
| 246 | + if (noFqn || Comparing.equal(fqn, type.getQualifiedName())) { |
241 | 247 | navigatable.setSourcePosition(XDebuggerUtil.getInstance().createPositionByOffset( |
242 | 248 | type.getContainingFile().getVirtualFile(), type.getTextOffset())); |
243 | 249 | return; |
|
0 commit comments