Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G5V8DT-24814 Некорректная вставка в область модуля вспомогательных методов событий #1437

Merged
merged 11 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bundles/com.e1c.v8codestyle.bsl.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ Bundle-Localization: plugin
Import-Package: com._1c.g5.ides.ui.texteditor.xtext.embedded;version="[6.0.0,7.0.0)",
com._1c.g5.v8.bm.core;version="[8.0.0,9.0.0)",
com._1c.g5.v8.dt.bsl.comment;version="[3.0.0,4.0.0)",
com._1c.g5.v8.dt.bsl.common;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.bsl.common;version="[7.0.0,8.0.0)",
com._1c.g5.v8.dt.bsl.documentation.comment;version="[4.0.0,5.0.0)",
com._1c.g5.v8.dt.bsl.formatting;version="[3.0.0,4.0.0)",
com._1c.g5.v8.dt.bsl.model;version="[5.0.0,6.0.0)",
com._1c.g5.v8.dt.bsl.model.util;version="[4.7.0,5.0.0)",
com._1c.g5.v8.dt.bsl.resource.owner;version="[2.0.0,3.0.0)",
com._1c.g5.v8.dt.bsl.services;version="[7.0.0,8.0.0)",
com._1c.g5.v8.dt.bsl.ui;version="[9.0.0,10.0.0)",
com._1c.g5.v8.dt.bsl.ui.contentassist;version="[8.0.0,9.0.0)",
com._1c.g5.v8.dt.bsl.ui.contentassist;version="[9.0.0,10.0.0)",
com._1c.g5.v8.dt.bsl.ui.editor;version="[10.0.0,11.0.0)",
com._1c.g5.v8.dt.bsl.ui.event;version="[5.0.0,6.0.0)",
com._1c.g5.v8.dt.bsl.ui.menu;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.bsl.ui.event;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.bsl.ui.menu;version="[7.0.0,8.0.0)",
com._1c.g5.v8.dt.bsl.ui.quickfix;version="[4.1.0,5.0.0)",
com._1c.g5.v8.dt.bsl.util;version="[8.0.0,9.0.0)",
com._1c.g5.v8.dt.common;version="[6.0.0,7.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private Triple<Integer, Integer, String> getFormatedDocComment(Module module, IT
int methodOffset = lines.get(0).getOffset();
int length = lines.get(lines.size() - 1).getEndOffset() - methodOffset;

String lineFormatter = proposalProvider.getLineFormatter(module, methodOffset, viewer.getDocument());
String lineFormatter = proposalProvider.getLineFormatter(module, viewer.getDocument(), methodOffset);
IV8Project project = v8projectManager.getProject(module);
boolean oldFormat = (project != null && project.getProject() != null)
? this.bslPreferences.getDocumentCommentProperties(project.getProject()).oldCommentFormat() : true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.e1c.v8codestyle.internal.bsl.ui.UiPlugin;

/**
* Provides offset and suffixes information of module region
* Provides offsets and suffixes information of module region
*
* @author Kuznetsov Nikita
*/
Expand All @@ -32,6 +32,8 @@ public final class BslModuleOffsets
private int endOffset;
private int insertOffset;

private boolean needReplace;

private Map<String, BslModuleOffsets> suffixes;

/**
Expand Down Expand Up @@ -89,6 +91,24 @@ public int getBeforeEndOffset()
return insertOffset;
}

/**
* Is need to replace existing module region
*
* @return <code>true</code> if need to replace existing region, <code>false</code> otherwise
*/
public boolean needReplace()
{
return needReplace;
}

/**
* Sets necessity of replacing existing module region
*/
public void setNeedReplace()
{
needReplace = true;
}

/**
* Add suffix of the name of this module region
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2023, 1C-Soft LLC and others.
* Copyright (C) 2023-2024, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -12,8 +12,9 @@
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.services;

import org.eclipse.emf.common.util.URI;

import com._1c.g5.v8.dt.bsl.common.IBslModuleTextInsertInfo;
import com._1c.g5.v8.dt.bsl.model.Module;

/**
* Built-in language module region information with {@link String} region wrap data
Expand All @@ -23,34 +24,47 @@
public class BslModuleRegionsInfo
implements IBslModuleTextInsertInfo
{
private final URI resourceURI;
private final int insertPosition;
private final Module module;
private final int clearPosition;
private final int clearLength;
private final String regionName;

/**
* {@link BslModuleRegionsInfo} constructor
*
* @param resourceURI current module or document resource {@link URI}, cannot be <code>null</code>
* @param insertPosition <code>int</code> insertion offset, cannot be negative
* @param module current {@link Module}, cannot be <code>null</code>
* @param clearPosition text clear <code>int</code> position, can be negative if no clear needed
* @param clearLength text clear <code>int</code> length, can be negative if no clear needed
* @param regionName {@link String} region name, can be <code>null</code>
*/
public BslModuleRegionsInfo(int insertPosition, Module module, String regionName)
public BslModuleRegionsInfo(URI resourceURI, int insertPosition, int clearPosition, int clearLength,
String regionName)
{
this.resourceURI = resourceURI;
this.insertPosition = insertPosition;
this.module = module;
this.clearPosition = clearPosition;
this.clearLength = clearLength;
this.regionName = regionName;
}

@Override
public int getInsertPosition()
public URI getResourceURI()
{
return resourceURI;
}

@Override
public int getPosition()
{
return insertPosition;
return clearLength > 0 ? clearPosition : insertPosition;
}

@Override
public Module getModule()
public int getClearLength()
{
return module;
return clearLength;
}

/**
Expand Down
Loading
Loading