@NotNull private HyperlinkLabel createHyperLink() { List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName()); String title = Joiner.on(" / ").join(path); final HyperlinkLabel settingsLink = new HyperlinkLabel(title); settingsLink.addHyperlinkListener(new HyperlinkAdapter() { public void hyperlinkActivated(HyperlinkEvent e) { DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink); OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext); if (optionsEditor == null) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project != null) { showSettings(project); } return; } Configurable configurable = optionsEditor.findConfigurableById(ESLintInspection.this.getId()); if (configurable != null) { optionsEditor.clearSearchAndSelect(configurable); } } }); return settingsLink; }
@Override protected boolean parseUnaryExpression() { final IElementType tokenType = builder.getTokenType(); if (tokenType == JSTokenTypes.OR) { builder.advanceLexer(); return true; } if (tokenType == EmberJSTokenTypes.ONE_TIME_BINDING) { final PsiBuilder.Marker expr = builder.mark(); builder.advanceLexer(); if (!super.parseUnaryExpression()) { builder.error(JSBundle.message("javascript.parser.message.expected.expression")); } expr.done(JSElementTypes.PREFIX_EXPRESSION); return true; } return super.parseUnaryExpression(); }
private void parseKeyValue() { builder.advanceLexer(); final PsiBuilder.Marker comma = builder.mark(); parseExplicitIdentifierWithError(); if (builder.getTokenType() == JSTokenTypes.COMMA) { builder.advanceLexer(); } else { builder.error(JSBundle.message("javascript.parser.message.expected.comma")); } parseExplicitIdentifierWithError(); comma.done(JSElementTypes.COMMA_EXPRESSION); if (builder.getTokenType() == JSTokenTypes.RPAR) { builder.advanceLexer(); } else { builder.error(JSBundle.message("javascript.parser.message.expected.rparen")); } }
@NotNull @Override public String[] getGroupPath() { return new String[]{ "JavaScript", JSBundle.message("js.linters.inspection.group.name") }; }
private void parseExplicitIdentifierWithError() { if (isIdentifierToken(builder.getTokenType())) { parseExplicitIdentifier(); } else { builder.error(JSBundle.message("javascript.parser.message.expected.identifier")); } }