rokucommunity / rokucommunity/brighterscript

Better code completion for extends

Open
#1,584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

I noticed that the code completion for after extends is a little rough.

Also extends is not even it's own Token? weird.

I'd expect these tests to pass:

describe('extends', () => {
        it('should show only other classes for a class', () => {
            program.setFile('source/main.bs', `
                class Klass1
                end class

                class Klass2 extends
                end class
            `);

            program.validate();
            //   class Klass2 extends |
            let completions = program.getCompletions('source/main.bs', util.createPosition(4, 37));
            expectCompletionsIncludes(completions, [{
                label: 'Klass1',
                kind: CompletionItemKind.Class
            }]);
            expect(completions.length).to.eql(1);
        });

        it('should show other interfaces and components for an interface', () => {

            program.setFile('components/myNode.xml',
                trim`<component name="myNode" extends="group">
                </component>
            `);

            program.setFile('source/main.bs', `
                interface IFace1
                end class

                interface IFace2 extends 
                end class
            `);

            program.validate();
            //   interface IFace2 extends |
            let completions = program.getCompletions('source/main.bs', util.createPosition(4, 42));
            expectCompletionsIncludes(completions, [{
                label: 'IFace1',
                kind: CompletionItemKind.Class
            }]);

            expectCompletionsIncludes(completions, [{
                label: 'roSGNodeMyNode',
                kind: CompletionItemKind.Interface
            }]);
        });

    });

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the completion path exercised by program.getCompletions in the supplied tests, and inspect how extends is tokenized and how class, interface, and component symbols are filtered. Use the two example cases as acceptance criteria: class completion should list only other classes, while interface completion should include interfaces and components.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.