private void registerYmlRoutePatternProblem(@NotNull ProblemsHolder holder, @NotNull YAMLKeyValue element) { String s = PsiElementUtils.trimQuote(element.getKeyText()); if("pattern".equals(s) && YamlHelper.isRoutingFile(element.getContainingFile())) { // pattern: foo holder.registerProblem(element.getKey(), "Pattern is deprecated; use path instead", ProblemHighlightType.LIKE_DEPRECATED); } else if(("_method".equals(s) || "_scheme".equals(s)) && YamlHelper.isRoutingFile(element.getContainingFile())) { // requirements: { _method: 'foo', '_scheme': 'foo' } YAMLKeyValue parentOfType = PsiTreeUtil.getParentOfType(element, YAMLKeyValue.class); if(parentOfType != null && "requirements".equals(parentOfType.getKeyText())) { holder.registerProblem(element.getKey(), String.format("The '%s' requirement is deprecated", s), ProblemHighlightType.LIKE_DEPRECATED); } } }
@Override public void insert(List<String> items) { PsiDocumentManager manager = PsiDocumentManager.getInstance(serviceKeyValue.getProject()); Document document = manager.getDocument(serviceKeyValue.getContainingFile()); if (document == null) { return; } List<String> arrayList = new ArrayList<>(); for (String item : items) { arrayList.add("'@" + (StringUtils.isNotBlank(item) ? item : "?") + "'"); } YamlHelper.putKeyValue(serviceKeyValue, "arguments", "[" + StringUtils.join(arrayList, ", ") + "]"); manager.doPostponedOperationsAndUnblockDocument(document); manager.commitDocument(document); } }
Document document = manager.getDocument(yamlKeyValue.getContainingFile()); if (document == null) { return;
public static void attachYamlFieldTypeName(String keyName, DoctrineModelField doctrineModelField, YAMLKeyValue yamlKeyValue) { if("fields".equals(keyName) || "id".equals(keyName)) { YAMLKeyValue yamlType = YamlHelper.getYamlKeyValue(yamlKeyValue, "type"); if(yamlType != null) { doctrineModelField.setTypeName(yamlType.getValueText()); } YAMLKeyValue yamlColumn = YamlHelper.getYamlKeyValue(yamlKeyValue, "column"); if(yamlColumn != null) { doctrineModelField.setColumn(yamlColumn.getValueText()); } return; } if(RELATIONS.contains(keyName.toLowerCase())) { YAMLKeyValue targetEntity = YamlHelper.getYamlKeyValue(yamlKeyValue, "targetEntity"); if(targetEntity != null) { doctrineModelField.setRelationType(keyName); doctrineModelField.setRelation(getOrmClass(yamlKeyValue.getContainingFile(), targetEntity.getValueText())); } } }
Document document = manager.getDocument(serviceKeyValue.getContainingFile()); if (document == null) { return;