Skip to content

Commit e28424a

Browse files
authored
Remove validate deployment from codelens (#251)
* Remove validate deployment from codelens * Updated README
1 parent 84b4ac8 commit e28424a

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ The server implements the Language Server Protocol (LSP) to enable code editors
4949
- **Artifact Export** - Export and upload template artifacts to S3 for deployment
5050

5151
### Code Lens Actions
52-
- **Validate Deployment** - Validate template deployment from the editor
53-
- **Deploy Template** - Deploy templates with a single click
52+
- **Validate and Deploy** - Validate and deploy templates with a single click
5453
- **Open Stack Template** - Open managed stack templates for resources
5554

5655
### Advanced Capabilities

src/codeLens/StackActionsCodeLens.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import { SyntaxTreeManager } from '../context/syntaxtree/SyntaxTreeManager';
55
import { Document } from '../document/Document';
66

77
const STACK_ACTION_TITLES = {
8-
VALIDATE_DEPLOYMENT: 'Validate Deployment',
9-
DEPLOY: 'Deploy Template',
8+
DEPLOY: 'Validate and Deploy',
109
} as const;
1110

1211
const STACK_ACTION_COMMANDS = {
13-
VALIDATE_DEPLOYMENT: 'aws.cloudformation.api.validateDeployment',
1412
DEPLOY: 'aws.cloudformation.api.deployTemplate',
1513
} as const;
1614

@@ -49,14 +47,6 @@ export function getStackActionsCodeLenses(
4947
const range = Range.create(Position.create(codeLensLine, 0), Position.create(codeLensLine, 0));
5048

5149
return [
52-
{
53-
range,
54-
command: {
55-
title: STACK_ACTION_TITLES.VALIDATE_DEPLOYMENT,
56-
command: STACK_ACTION_COMMANDS.VALIDATE_DEPLOYMENT,
57-
arguments: [uri],
58-
},
59-
},
6050
{
6151
range,
6252
command: {

tst/unit/codeLens/StackActionsCodeLens.test.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('StackActionsCodeLens', () => {
6868
expect(result).toEqual([]);
6969
});
7070

71-
it('should return two code lenses for valid CFN template with Resources', () => {
71+
it('should return one code lens for valid CFN template with Resources', () => {
7272
mockSyntaxTreeManager.getSyntaxTree.returns({ rootNode: {} } as any);
7373
mockGetEntityMap.mockReturnValue(new Map([['Bucket', {}]]));
7474

@@ -78,13 +78,10 @@ describe('StackActionsCodeLens', () => {
7878

7979
const result = getStackActionsCodeLenses('file:///test.yaml', document, mockSyntaxTreeManager);
8080

81-
expect(result).toHaveLength(2);
82-
expect(result[0].command?.title).toBe('Validate Deployment');
83-
expect(result[0].command?.command).toBe('aws.cloudformation.api.validateDeployment');
81+
expect(result).toHaveLength(1);
82+
expect(result[0].command?.title).toBe('Validate and Deploy');
83+
expect(result[0].command?.command).toBe('aws.cloudformation.api.deployTemplate');
8484
expect(result[0].command?.arguments).toEqual(['file:///test.yaml']);
85-
expect(result[1].command?.title).toBe('Deploy Template');
86-
expect(result[1].command?.command).toBe('aws.cloudformation.api.deployTemplate');
87-
expect(result[1].command?.arguments).toEqual(['file:///test.yaml']);
8885
});
8986

9087
it('should place code lens on line 0 for simple template', () => {
@@ -165,7 +162,7 @@ describe('StackActionsCodeLens', () => {
165162

166163
const result = getStackActionsCodeLenses('file:///test.yaml', document, mockSyntaxTreeManager);
167164

168-
expect(result).toHaveLength(2);
165+
expect(result).toHaveLength(1);
169166
expect(result[0].range.start.line).toBe(0);
170167
});
171168

@@ -184,7 +181,7 @@ describe('StackActionsCodeLens', () => {
184181

185182
const result = getStackActionsCodeLenses('file:///test.yaml', document, mockSyntaxTreeManager);
186183

187-
expect(result).toHaveLength(2);
184+
expect(result).toHaveLength(1);
188185
});
189186

190187
it('should handle JSON template', () => {
@@ -197,7 +194,7 @@ describe('StackActionsCodeLens', () => {
197194

198195
const result = getStackActionsCodeLenses('file:///test.json', document, mockSyntaxTreeManager);
199196

200-
expect(result).toHaveLength(2);
197+
expect(result).toHaveLength(1);
201198
});
202199

203200
it('should handle template with multiple resources', () => {
@@ -221,7 +218,7 @@ describe('StackActionsCodeLens', () => {
221218

222219
const result = getStackActionsCodeLenses('file:///test.yaml', document, mockSyntaxTreeManager);
223220

224-
expect(result).toHaveLength(2);
221+
expect(result).toHaveLength(1);
225222
});
226223

227224
it('should handle whitespace-only lines correctly', () => {

tst/unit/handlers/CodeLensHandler.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ describe('CodeLensHandler', () => {
7878

7979
const result = await handler(params, CancellationToken.None);
8080

81-
expect(result).toHaveLength(3);
82-
expect(result[0].command?.title).toBe('Validate Deployment');
83-
expect(result[1].command?.title).toBe('Deploy Template');
84-
expect(result[2].command?.title).toBe('Open Stack Template');
81+
expect(result).toHaveLength(2);
82+
expect(result[0].command?.title).toBe('Validate and Deploy');
83+
expect(result[1].command?.title).toBe('Open Stack Template');
8584
});
8685

8786
it('should not return stack actions for empty files', async () => {
@@ -161,8 +160,7 @@ describe('CodeLensHandler', () => {
161160

162161
const result = await handler(params, CancellationToken.None);
163162

164-
expect(result).toHaveLength(2);
163+
expect(result).toHaveLength(1);
165164
expect(result[0].command?.arguments).toEqual(['file:///test.yaml']);
166-
expect(result[1].command?.arguments).toEqual(['file:///test.yaml']);
167165
});
168166
});

0 commit comments

Comments
 (0)