Skip to content

Commit

Permalink
dev: work on issues panel (#2905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Oct 29, 2023
1 parent 41ba506 commit a965d6b
Show file tree
Hide file tree
Showing 17 changed files with 641 additions and 282 deletions.
77 changes: 39 additions & 38 deletions docs/_includes/generated-docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,42 @@

# Commands

| Command | Title |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `cSpell.addIgnoreWord` | Ignore Words |
| `cSpell.addIgnoreWordsToFolder` | Ignore Word in Folder Settings |
| `cSpell.addIgnoreWordsToUser` | Ignore Words in User Settings |
| `cSpell.addIgnoreWordsToWorkspace` | Ignore Words in Workspace Settings |
| `cSpell.addIssuesToDictionary` | Add All Spelling Issues to Dictionary |
| `cSpell.addWordToCSpellConfig` | Add Words to CSpell Configuration |
| `cSpell.addWordToDictionary` | Add Words to Dictionary |
| `cSpell.addWordToFolderDictionary` | Add Words to Folder Dictionary |
| `cSpell.addWordToFolderSettings` | Add Words to Folder Settings |
| `cSpell.addWordToUserDictionary` | Add Words to User Dictionary |
| `cSpell.addWordToUserSettings` | Add Words to User Settings |
| `cSpell.addWordToWorkspaceDictionary` | Add Words to Workspace Dictionary |
| `cSpell.addWordToWorkspaceSettings` | Add Words to Workspace Settings |
| `cSpell.autoFixSpellingIssues` | Fix all issues with a preferred suggestion in the current document. |
| `cSpell.createCSpellConfig` | Create a CSpell Configuration File. |
| `cSpell.createCustomDictionary` | Create a Custom Dictionary File. |
| `cSpell.disableCurrentLanguage` | Disable Spell Checking Document Language |
| `cSpell.disableForGlobal` | Disable Spell Checking by Default |
| `cSpell.disableForWorkspace` | Disable Spell Checking For Workspace |
| `cSpell.displayCSpellInfo` | Show Spell Checker Configuration Info |
| `cSpell.enableCurrentLanguage` | Enable Spell Checking Document Language |
| `cSpell.enableForGlobal` | Enable Spell Checking by Default |
| `cSpell.enableForWorkspace` | Enable Spell Checking For Workspace |
| `cSpell.goToNextSpellingIssue` | Go to Next Spelling Issue |
| `cSpell.goToNextSpellingIssueAndSuggest` | Go to Next Spelling Issue and Suggest |
| `cSpell.goToPreviousSpellingIssue` | Go to Previous Spelling Issue |
| `cSpell.goToPreviousSpellingIssueAndSuggest` | Go to Previous Spelling Issue and Suggest |
| `cSpell.logPerfTimeline` | Log CSpell performance times to console |
| `cSpell.openSuggestionsForIssue` | Show Suggestions<br>**When:**<br> `view == cspell-info.issuesView` |
| `cSpell.removeWordFromFolderDictionary` | Remove Words from the Folder Dictionary |
| `cSpell.removeWordFromUserDictionary` | Remove Words from the Global Dictionary |
| `cSpell.removeWordFromWorkspaceDictionary` | Remove Words from the Workspace Dictionaries |
| `cSpell.suggestSpellingCorrections` | Spelling Suggestions...<br>**When:**<br> `editorTextFocus && cSpell.editorMenuContext.showSuggestions` |
| `cSpell.toggleEnableForGlobal` | Toggle Spell Checking in User Settings |
| `cSpell.toggleEnableForWorkspace` | Toggle Spell Checking for Workspace |
| `cSpell.toggleEnableSpellChecker` | Toggle Spell Checking |
| Command | Title |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `cSpell.addIgnoreWord` | Ignore Words |
| `cSpell.addIgnoreWordsToFolder` | Ignore Word in Folder Settings |
| `cSpell.addIgnoreWordsToUser` | Ignore Words in User Settings |
| `cSpell.addIgnoreWordsToWorkspace` | Ignore Words in Workspace Settings |
| `cSpell.addIssuesToDictionary` | Add All Spelling Issues to Dictionary |
| `cSpell.addWordToCSpellConfig` | Add Words to CSpell Configuration |
| `cSpell.addWordToDictionary` | Add Words to Dictionary |
| `cSpell.addWordToFolderDictionary` | Add Words to Folder Dictionary |
| `cSpell.addWordToFolderSettings` | Add Words to Folder Settings |
| `cSpell.addWordToUserDictionary` | Add Words to User Dictionary |
| `cSpell.addWordToUserSettings` | Add Words to User Settings |
| `cSpell.addWordToWorkspaceDictionary` | Add Words to Workspace Dictionary |
| `cSpell.addWordToWorkspaceSettings` | Add Words to Workspace Settings |
| `cSpell.autoFixSpellingIssues` | Fix all issues with a preferred suggestion in the current document. |
| `cSpell.createCSpellConfig` | Create a CSpell Configuration File. |
| `cSpell.createCustomDictionary` | Create a Custom Dictionary File. |
| `cSpell.disableCurrentLanguage` | Disable Spell Checking Document Language |
| `cSpell.disableForGlobal` | Disable Spell Checking by Default |
| `cSpell.disableForWorkspace` | Disable Spell Checking For Workspace |
| `cSpell.displayCSpellInfo` | Show Spell Checker Configuration Info |
| `cSpell.enableCurrentLanguage` | Enable Spell Checking Document Language |
| `cSpell.enableForGlobal` | Enable Spell Checking by Default |
| `cSpell.enableForWorkspace` | Enable Spell Checking For Workspace |
| `cSpell.goToNextSpellingIssue` | Go to Next Spelling Issue |
| `cSpell.goToNextSpellingIssueAndSuggest` | Go to Next Spelling Issue and Suggest |
| `cSpell.goToPreviousSpellingIssue` | Go to Previous Spelling Issue |
| `cSpell.goToPreviousSpellingIssueAndSuggest` | Go to Previous Spelling Issue and Suggest |
| `cSpell.issueViewer.item.autoFixSpellingIssues` | Fix issue with preferred suggestion in the current document.<br>**When:**<br> `view == cspell-info.issuesView` |
| `cSpell.issueViewer.item.openSuggestionsForIssue` | Show Suggestions<br>**When:**<br> `view == cspell-info.issuesView` |
| `cSpell.logPerfTimeline` | Log CSpell performance times to console |
| `cSpell.removeWordFromFolderDictionary` | Remove Words from the Folder Dictionary |
| `cSpell.removeWordFromUserDictionary` | Remove Words from the Global Dictionary |
| `cSpell.removeWordFromWorkspaceDictionary` | Remove Words from the Workspace Dictionaries |
| `cSpell.suggestSpellingCorrections` | Spelling Suggestions...<br>**When:**<br> `editorTextFocus && cSpell.editorMenuContext.showSuggestions` |
| `cSpell.toggleEnableForGlobal` | Toggle Spell Checking in User Settings |
| `cSpell.toggleEnableForWorkspace` | Toggle Spell Checking for Workspace |
| `cSpell.toggleEnableSpellChecker` | Toggle Spell Checking |
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
"group": "inline"
},
{
"command": "cSpell.openSuggestionsForIssue",
"when": "view == cspell-info.issuesView",
"command": "cSpell.issueViewer.item.autoFixSpellingIssues",
"when": "view == cspell-info.issuesView && viewItem == issue.hasPreferred",
"group": "inline"
}
]
Expand All @@ -185,14 +185,7 @@
{
"id": "cspell-info-explorer",
"title": "Spell Checker",
"icon": "resources/dark/check_circle.svg",
"when": "config.cSpell.experimental.enableSettingsViewerV2"
},
{
"id": "cspell-regexp-explorer",
"title": "Spell Checker Regular Expression Viewer",
"icon": "resources/dark/check_circle.svg",
"when": "config.cSpell.experimental.enableRegexpView"
"icon": "resources/dark/check_circle.svg"
}
]
},
Expand All @@ -206,22 +199,23 @@
{
"type": "webview",
"id": "cspell-info.infoView",
"name": "Spell Checker"
"name": "Spell Checker",
"when": "config.cSpell.experimental.enableSettingsViewerV2"
},
{
"type": "webview",
"id": "cspell-info.todoView",
"name": "Spell Checker Todos"
}
],
"cspell-regexp-explorer": [
"name": "Spell Checker Todos",
"when": "config.cSpell.experimental.enableSettingsViewerV2"
},
{
"id": "cSpellRegExpView",
"name": "Regular Expressions",
"when": "config.cSpell.experimental.enableRegexpView"
}
]
},
"viewsWelcome": [],
"commands": [
{
"command": "cspell-info.showHelloWorld",
Expand Down Expand Up @@ -410,7 +404,7 @@
"icon": "$(edit)"
},
{
"command": "cSpell.openSuggestionsForIssue",
"command": "cSpell.issueViewer.item.openSuggestionsForIssue",
"title": "Show Suggestions",
"icon": "$(list-unordered)",
"enablement": "view == cspell-info.issuesView"
Expand All @@ -419,6 +413,12 @@
"command": "cSpell.autoFixSpellingIssues",
"title": "Fix all issues with a preferred suggestion in the current document.",
"icon": "$(lightbulb-autofix)"
},
{
"command": "cSpell.issueViewer.item.autoFixSpellingIssues",
"title": "Fix issue with preferred suggestion in the current document.",
"icon": "$(lightbulb-autofix)",
"enablement": "view == cspell-info.issuesView"
}
],
"languages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/_server/src/api/CommandsToClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ConfigurationTarget } from './apiModels.js';
import type { OrPromise } from './types.js';
import type { OrPromise } from './generics.js';

export interface CommandsToClient {
addWordsToVSCodeSettingsFromServer: (words: string[], documentUri: string, target: ConfigurationTarget) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/_server/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface ServerRequestsAPI {
getConfigurationForDocument(req: GetConfigurationForDocumentRequest): GetConfigurationForDocumentResult;
isSpellCheckEnabled(req: TextDocumentInfo): IsSpellCheckEnabledResult;
splitTextIntoWords(req: string): SplitTextIntoWordsResult;
spellingSuggestions(word: string, doc: TextDocumentInfo): SpellingSuggestionsResult;
spellingSuggestions(word: string, doc?: TextDocumentInfo): SpellingSuggestionsResult;
}

/** Notifications that can be sent to the server */
Expand Down
23 changes: 14 additions & 9 deletions packages/_server/src/api/apiModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type {
ConfigTargetDictionary,
ConfigTargetVSCode,
} from '../config/configTargets.mjs';
export type { Position, Range } from 'vscode-languageserver-types';

export interface BlockedFileReason {
code: string;
Expand Down Expand Up @@ -65,13 +66,7 @@ export interface SpellingSuggestionsResult {
suggestions: Suggestion[];
}

export interface TextDocumentInfo {
uri?: UriString;
languageId?: string;
text?: string;
}

export interface GetConfigurationForDocumentRequest extends TextDocumentInfo {
export interface GetConfigurationForDocumentRequest extends Partial<TextDocumentInfo> {
/** used to calculate configTargets, configTargets will be empty if undefined. */
workspaceConfig?: WorkspaceConfigForDocument;
}
Expand All @@ -84,7 +79,17 @@ export interface GetConfigurationForDocumentResult extends IsSpellCheckEnabledRe
}

export interface TextDocumentRef {
uri: UriString;
readonly uri: DocumentUri;
}

export interface TextDocumentInfo extends TextDocumentRef {
readonly languageId?: string;
readonly text?: string;
readonly version?: number;
}

export interface TextDocumentInfoWithText extends TextDocumentInfo {
readonly text: string;
}

export interface NamedPattern {
Expand All @@ -93,7 +98,7 @@ export interface NamedPattern {
}

export interface MatchPatternsToDocumentRequest extends TextDocumentRef {
patterns: (string | NamedPattern)[];
readonly patterns: (string | NamedPattern)[];
}

export interface RegExpMatch {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/_server/src/codeAction.test.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, test } from 'vitest';

import { onCodeActionHandler } from './codeActions.mjs';
import { createOnCodeActionHandler } from './codeActions.mjs';

describe('Validate CodeAction', () => {
test('onCodeActionHandler', () => {
// Place holder test.
expect(typeof onCodeActionHandler).toBe('function');
expect(typeof createOnCodeActionHandler).toBe('function');
});
});
2 changes: 1 addition & 1 deletion packages/_server/src/codeActions.mts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface CodeActionHandlerDependencies {
fetchWorkspaceConfigForDocument: (uri: UriString) => Promise<WorkspaceConfigForDocument>;
}

export function onCodeActionHandler(
export function createOnCodeActionHandler(
documents: TextDocuments<TextDocument>,
dependencies: CodeActionHandlerDependencies,
): (params: CodeActionParams) => Promise<CodeAction[]> {
Expand Down
Loading

0 comments on commit a965d6b

Please sign in to comment.