Skip to content

Commit

Permalink
Merge pull request #47 from PJB3005/fix-some-duping
Browse files Browse the repository at this point in the history
Fix some duping
  • Loading branch information
Keisuke KATO authored Jun 25, 2017
2 parents a35ed46 + 1605811 commit 5a7d986
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Domain/Lang/DocommentDomainCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ export class DocommentDomainCSharp extends DocommentDomain {
/* @override */
public GetCodeType(code: string): CodeType {

// If the previous line was a doc comment and we hit enter.
// Extend the doc comment without generating anything else,
// even if there's a method or something next line.
if (this._isEnterKey && SyntacticAnalysisCSharp.IsDocComment(this._vsCodeApi.ReadLineAtCurrent())) {
return CodeType.Comment;
}

/* method */
if (SyntacticAnalysisCSharp.IsMethod(code)) return CodeType.Method;

Expand Down Expand Up @@ -121,6 +128,7 @@ export class DocommentDomainCSharp extends DocommentDomain {

let paramNameList: Array<string> = null;
let hasReturn = false;

switch (codeType) {
case CodeType.Namespace:
break;
Expand Down
6 changes: 5 additions & 1 deletion src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ export class SyntacticAnalysisCSharp {
return (activeChar === '/');
}

/**
* Tests whether a line contains ONLY a doc comment and nothing else except whitespace.
* @param activeLine The line to test.
*/
public static IsDocCommentStrict(activeLine: string): boolean {
return activeLine.match(/(?:[^/]\/{3}[ \t]*$)|(?:^\/{3}[^/])|(?:^\/{3}[ \t]*$)/) !== null; // FIXME:
return activeLine.match(/^[ \t]*\/{3}[ \t]*$/) !== null; // FIXME:
}

public static IsDocComment(activeLine: string): boolean {
Expand Down

0 comments on commit 5a7d986

Please sign in to comment.