Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
a1c3641f
Commit
a1c3641f
authored
6 years ago
by
Alexander Doroshko
Browse files
Options
Download
Email Patches
Plain Diff
EA-137940 - ISE: OffsetMap.getOffset
parent
25bf3dc0
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java
+2
-1
.../intellij/codeInsight/completion/XmlTagInsertHandler.java
with
2 additions
and
1 deletion
+2
-1
xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java
+
2
-
1
View file @
a1c3641f
...
...
@@ -59,6 +59,7 @@ public class XmlTagInsertHandler implements InsertHandler<LookupElement> {
public
void
handleInsert
(
@NotNull
InsertionContext
context
,
@NotNull
LookupElement
item
)
{
Project
project
=
context
.
getProject
();
Editor
editor
=
context
.
getEditor
();
int
startOffset
=
context
.
getStartOffset
();
Document
document
=
InjectedLanguageUtil
.
getTopLevelEditor
(
editor
).
getDocument
();
Ref
<
PsiElement
>
currentElementRef
=
Ref
.
create
();
// Need to insert " " to prevent creating tags like <tagThis is my text
...
...
@@ -66,7 +67,7 @@ public class XmlTagInsertHandler implements InsertHandler<LookupElement> {
final
int
offset
=
editor
.
getCaretModel
().
getOffset
();
editor
.
getDocument
().
insertString
(
offset
,
" "
);
PsiDocumentManager
.
getInstance
(
project
).
commitDocument
(
editor
.
getDocument
());
currentElementRef
.
set
(
context
.
getFile
().
findElementAt
(
context
.
getS
tartOffset
()
));
currentElementRef
.
set
(
context
.
getFile
().
findElementAt
(
s
tartOffset
));
editor
.
getDocument
().
deleteString
(
offset
,
offset
+
1
);
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help