Skip to content

Commit

Permalink
Fixed #104 activate on enter
Browse files Browse the repository at this point in the history
  • Loading branch information
kasecato committed Jul 27, 2020
1 parent 292e837 commit d441fd8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Domain/Lang/DocommentDomainCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SyntacticAnalysisCSharp } from '../../SyntacticAnalysis/SyntacticAnalys
import { StringUtil } from '../../Utility/StringUtil';
import { DocommentDomain } from '../DocommentDomain';
import { CodeType } from '../IDocommentDomain';
import { CommentSyntax } from '../../Entity/Config/Contributes/Configuration';

export class DocommentDomainCSharp extends DocommentDomain {

Expand Down Expand Up @@ -48,15 +49,25 @@ export class DocommentDomainCSharp extends DocommentDomain {
this._isEnterKey = isEnterKey;

// NG: Activate on Enter NOT '/'
const activeLine: string = this._vsCodeApi.ReadLineAtCurrent();
let isActivateKeyDelimited: boolean;
if (this._config.activateOnEnter) {
if (!isEnterKey) {
return false;
}
if (this._config.syntax === CommentSyntax.delimited) {
isActivateKeyDelimited = SyntacticAnalysisCSharp.IsDocCommentStrict(activeLine, this._config.syntax);
}
}

// NG: After Insert DocComment
const isAfterDocComment: boolean = (activeChar == ' ') && !isActivationKey && isEnterKey;
if (isAfterDocComment) {
return false;
}

// NG: '////'
const activeLine: string = this._vsCodeApi.ReadLineAtCurrent();
if (isActivationKey) {
if (isActivationKey || isActivateKeyDelimited) {
// NG: '////'
if (!SyntacticAnalysisCSharp.IsDocCommentStrict(activeLine, this._config.syntax)) {
return false;
Expand All @@ -67,9 +78,8 @@ export class DocommentDomainCSharp extends DocommentDomain {
return false;
}
}

// Comment Line
if (isEnterKey) {
else if (isEnterKey) {
// NG: '////'
const isInsertLineAbove = SyntacticAnalysisCSharp.IsInsertLineAbove(activeLine);
if (isInsertLineAbove) {
Expand Down

0 comments on commit d441fd8

Please sign in to comment.