header.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* header.ts :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: frfrey <frfrey@student.42lyon.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2020/07/23 20:24:24 by frfrey #+# #+# */
  9. /* Updated: 2020/07/23 20:24:24 by frfrey ### ########lyon.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. import * as vscode from 'vscode';
  13. import { assert } from 'console';
  14. export async function getHeadercpp(command: string, filePathCpp: vscode.Uri) {
  15. if (command && command.length > 0)
  16. {
  17. await vscode.workspace.openTextDocument(filePathCpp).then((a: vscode.TextDocument) => {
  18. vscode.window.showTextDocument(a, 1, false).then( e => {
  19. e.edit(() => {
  20. vscode.commands.executeCommand(command).then(() => {});
  21. });
  22. });
  23. }, (err: any) => {
  24. vscode.window.showErrorMessage("Header Cpp Class: " + err.message);
  25. });
  26. vscode.workspace.onDidSaveTextDocument;
  27. vscode.workspace.onDidCloseTextDocument;
  28. }
  29. }
  30. export async function getHeaderhpp(command: string, filePathHpp: vscode.Uri) {
  31. if (command && command.length > 0)
  32. {
  33. await vscode.workspace.openTextDocument(filePathHpp).then((a: vscode.TextDocument) => {
  34. vscode.window.showTextDocument(a, 1, false).then( e => {
  35. e.edit(() => {
  36. vscode.commands.executeCommand(command).then(() => {});
  37. });
  38. });
  39. }, (err: any) => {
  40. vscode.window.showErrorMessage("Header Cpp Class: " + err.message);
  41. });
  42. vscode.workspace.onDidSaveTextDocument;
  43. vscode.workspace.onDidCloseTextDocument;
  44. }
  45. }