Skip to content

Commit

Permalink
chore: fix various typos repo-wide (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
camerondubas authored Oct 1, 2023
1 parent ece2345 commit 4635e71
Show file tree
Hide file tree
Showing 27 changed files with 125 additions and 126 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ All features currently only work in Ember CLI application that use the default c
- all addons could be added as dev-dependency for a project
- dev-dependency installation allow us to have independent versions of addons for different projects
- for global addon installation check LS settings in your editor (you have to specify path to addon root in LS config)
- you could [build](https:/lifeart/ember-language-server/wiki/Addon-API) your project-sepecific addon
- you could [build](https:/lifeart/ember-language-server/wiki/Addon-API) your project-specific addon

---

Expand All @@ -73,11 +73,11 @@ new Server({fs, type})
```


`fs` - available options:
`fs` - available options:
* `sync` - LS should use nodejs.fs logic
* `async` - LS should use client's fs provider

`type` - available options:
`type` - available options:
* `node` - supported addons & require logic
* `worker` - addons and require logic not supported

Expand All @@ -90,6 +90,6 @@ new Server({fs, type})

---

## Licence
## License

[MIT](LICENSE.md)
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

There are two ways by which we can spawn the server: ipc and stdio. WE are
using stdio for spawning the server right now because of a (probable) timing
sissue setting up the ipc channel across the process lineage `test -> spawned nyc processs ->
issue setting up the ipc channel across the process lineage `test -> spawned nyc process ->
ELS server`. This had manifest in two ways as below:


Expand Down
4 changes: 2 additions & 2 deletions src/builtin-addons/core/intl-completion-provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompletionItem, CompletionItemKind } from 'vscode-languageserver';
import { CompletionFunctionParams, Server } from '../..';
import { isLocalizationHelperTranslataionName } from '../../utils/ast-helpers';
import { isLocalizationHelperTranslationName } from '../../utils/ast-helpers';
import { getTranslations } from './intl-utils';

export default class IntlCompletionProvider {
Expand All @@ -13,7 +13,7 @@ export default class IntlCompletionProvider {
async onComplete(root: string, params: CompletionFunctionParams): Promise<CompletionItem[]> {
const { focusPath, position, results, type } = params;

if (isLocalizationHelperTranslataionName(focusPath, type)) {
if (isLocalizationHelperTranslationName(focusPath, type)) {
const items = await getTranslations(root, this.server);
const PLACEHOLDER = 'ELSCompletionDummy';
const node = focusPath.node as any;

Check warning on line 19 in src/builtin-addons/core/intl-completion-provider.ts

View workflow job for this annotation

GitHub Actions / Node 14.x - ubuntu

Unexpected any. Specify a different type
Expand Down
4 changes: 2 additions & 2 deletions src/builtin-addons/core/intl-definition-provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Definition } from 'vscode-languageserver';
import { DefinitionFunctionParams, Server } from '../..';
import { isLocalizationHelperTranslataionName } from '../../utils/ast-helpers';
import { isLocalizationHelperTranslationName } from '../../utils/ast-helpers';
import { getTranslations } from './intl-utils';

export default class IntlDefinitionProvider {
Expand All @@ -13,7 +13,7 @@ export default class IntlDefinitionProvider {
async onDefinition(root: string, params: DefinitionFunctionParams): Promise<Definition[]> {
const { focusPath, type, results } = params;

if (isLocalizationHelperTranslataionName(focusPath, type)) {
if (isLocalizationHelperTranslationName(focusPath, type)) {
const items = await getTranslations(root, this.server);
const node = focusPath.node as any;

Check warning on line 18 in src/builtin-addons/core/intl-definition-provider.ts

View workflow job for this annotation

GitHub Actions / Node 14.x - ubuntu

Unexpected any. Specify a different type
const key = node.value;
Expand Down
4 changes: 2 additions & 2 deletions src/builtin-addons/core/intl-hover-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Hover } from 'vscode-languageserver';
import { Server } from '../..';
import { nodeLoc } from '../../glimmer-utils';
import { HoverFunctionParams } from '../../utils/addon-api';
import { isLocalizationHelperTranslataionName } from '../../utils/ast-helpers';
import { isLocalizationHelperTranslationName } from '../../utils/ast-helpers';
import { getTranslations } from './intl-utils';

export default class IntlHoverProvider {
Expand All @@ -15,7 +15,7 @@ export default class IntlHoverProvider {
async onHover(root: string, params: HoverFunctionParams): Promise<Hover[]> {
const { results, focusPath, type } = params;

if (isLocalizationHelperTranslataionName(focusPath, type)) {
if (isLocalizationHelperTranslationName(focusPath, type)) {
const node = focusPath.node as ASTv1.StringLiteral;
const key = node.value;
const translations = await getTranslations(root, this.server);
Expand Down
2 changes: 1 addition & 1 deletion src/builtin-addons/core/template-completion-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type ScopedValuesMetadata = {
* paths.
* @param addonsMeta addons meta array
* @param server Server
* @param focusPath currentfocus path
* @param focusPath current focus path
* @returns { [key: string]: string[] }
*/
export function generateNamespacedComponentsHashMap(addonsMeta: Array<AddonMeta>, server: Server, isAngleComponent: boolean) {
Expand Down
6 changes: 3 additions & 3 deletions src/builtin-addons/core/template-definition-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { getAllTemplateTokens } from '../../utils/usages-api';
function getComponentAndAddonName(rawComponentName: string) {
const componentParts = rawComponentName.split('$');
const addonName = componentParts.length > 1 ? componentParts[0] : '';
// If the component name doesnt have a batman syntax then just return the name of the component
// If the component name doesn't have a batman syntax then just return the name of the component
// Else returns the name of the component.
const componentName = componentParts.pop() as string;

Expand Down Expand Up @@ -87,7 +87,7 @@ export default class TemplateDefinitionProvider {
definitions = await this.provideComponentDefinition(componentName, addonName);
} else if (this.isAngleComponent(focusPath)) {
// <FooBar />
definitions = await this.provideAngleBrackedComponentDefinition(focusPath);
definitions = await this.provideAngleBracketedComponentDefinition(focusPath);
// {{#foo-bar}} {{/foo-bar}}
} else if (this.isMayBeComponentFromPath(focusPath)) {
const [key, ...tail] = (focusPath.node as ASTv1.ElementNode).tag.split('.');
Expand Down Expand Up @@ -201,7 +201,7 @@ export default class TemplateDefinitionProvider {

return pathsToLocations(...existingPaths);
}
provideAngleBrackedComponentDefinition(focusPath: ASTPath) {
provideAngleBracketedComponentDefinition(focusPath: ASTPath) {
return this.provideLikelyComponentTemplatePath((focusPath.node as ASTv1.ElementNode).tag);
}
async provideBlockComponentDefinition(focusPath: ASTPath): Promise<Location[]> {
Expand Down
6 changes: 3 additions & 3 deletions src/completion-provider/template-completion-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ function getTextPrefix(astPath: ASTPath, normalPlaceholder: string): string {
// handle block params autocomplete case
if (node.type === 'ElementNode' || node.type === 'BlockStatement') {
const meta = astPath.metaForType('handlebars');
const maybeBlockDefenition = meta && meta.maybeBlockParamDefinition;
const maybeBlockDefinition = meta && meta.maybeBlockParamDefinition;

if (maybeBlockDefenition) {
node = maybeBlockDefenition;
if (maybeBlockDefinition) {
node = maybeBlockDefinition;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/definition-providers/glimmer-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default class GlimmerScriptDefinitionProvider {

let rangeWalker = new RangeWalker(ranges);

// strip not needed scopes example
// strip not needed scopes example
rangeWalker = rangeWalker.subtract(rangeWalker.hbsInlineComments(true));
rangeWalker = rangeWalker.subtract(rangeWalker.hbsComments(true));
Expand Down
4 changes: 2 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ export default class Server {
}
}

// After the server has started the client sends an initilize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilites.
// After the server has started the client sends an initialize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilities.
private async onInitialize({ rootUri, rootPath, workspaceFolders, initializationOptions, capabilities }: InitializeParams): Promise<InitializeResult> {
rootPath = rootUri ? URI.parse(rootUri).fsPath : rootPath;
this.clientCapabilities = capabilities || {};
Expand Down
2 changes: 1 addition & 1 deletion src/template-linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export default class TemplateLinter {
}

const linterPath = await (Files.resolveModulePath(project.root, 'ember-template-lint', nodePath, () => {
/* intentially empty default callback */
/* intentionally empty default callback */
}) as Promise<string>);

if (!linterPath) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ast-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ export function isModelReference(astPath: ASTPath): boolean {
return expressionHasIdentifierName(parent, ['belongsTo', 'hasMany']);
}

export function isLocalizationHelperTranslataionName(focusPath: ASTPath, type: 'script' | 'template'): boolean {
export function isLocalizationHelperTranslationName(focusPath: ASTPath, type: 'script' | 'template'): boolean {
const parent = focusPath.parent;

if (!parent) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/definition-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function pathsToLocations(...paths: string[]): Location[] {
});
}

export function getFirstTextPostion(text: string, content: string) {
export function getFirstTextPosition(text: string, content: string) {
const arrayOfLines = text.match(/(.*?(?:\r\n?|\n|$))/gm) || [];
let startLine = 0;
let startCharacter = 0;
Expand Down Expand Up @@ -82,7 +82,7 @@ export async function pathsToLocationsWithPosition(paths: string[], findMe: stri
return null;
}

const [startLine, startCharacter] = getFirstTextPostion(text, findMe);
const [startLine, startCharacter] = getFirstTextPosition(text, findMe);

return Location.create(URI.file(fileName).toString(), Range.create(startLine, startCharacter, startLine, startCharacter + findMe.length));
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/glimmer-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class RangeWalker {
};

if (part.loc.start.line !== lineNumber && part.loc.end.line !== lineNumber) {
// replace in-range characters with blank lines (dont have better idea for now)
// replace in-range characters with blank lines (don't have better idea for now)
rangeLine.characters = rangeLine.characters.map(() => charPlaceholder);
} else if (part.loc.start.line === lineNumber && part.loc.end.line === lineNumber) {
rangeLine.characters = rangeLine.characters.map((char, index) => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/usages-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MatchResultType } from './path-matcher';
import { fsProvider } from '../fs-provider';
import { logDebugInfo } from './logger';
import { preprocess } from '@glimmer/syntax';
import { extractYeildMetadata, TemplateYieldContext } from './yield-context-extractor';
import { extractYieldMetadata, TemplateYieldContext } from './yield-context-extractor';

export interface TemplateTokenMeta {
source: string;
Expand Down Expand Up @@ -152,7 +152,7 @@ async function extractTokens() {

if (kind === 'component' && content.includes('{{yield')) {
try {
yieldMeta = extractYeildMetadata(ast);
yieldMeta = extractYieldMetadata(ast);
} catch (e) {
yieldMeta = {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/yield-context-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ASTv1 } from '@glimmer/syntax';
export type CaseContent = null | ['component' | 'helper' | 'modifier', string | string[]];
export type TemplateYieldContext = Record<string, CaseContent>;

export function extractYeildMetadata(template: ASTv1.Template) {
export function extractYieldMetadata(template: ASTv1.Template) {
type ExpressionResult = {
$fn: string;
$params?: unknown[];
Expand Down
Loading

0 comments on commit 4635e71

Please sign in to comment.